xxtimeUtils

package
v0.0.0-...-63b2ac5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Format_common_minus = "2006-01-02 15:04:05"
	Format_common_slash = "2006/01/02 15:04:05"
	Format_common_date  = "2006-01-02"
	Format_common_date2 = "2006/01/02"

	// TimeFormat is the time format to use when generating times in HTTP
	// headers. It is like time.RFC1123 but hard-codes GMT as the time
	// zone. The time being formatted must be in UTC for Format to
	// generate the correct format.
	//
	// For parsing this time format, see ParseTime.
	// from golang/http/fs.go
	Format_standard_GMT = "Mon, 02 Jan 2006 15:04:05 GMT"
)

https://www.cnblogs.com/sandea/p/9696712.html 时间可分为时间点与时间段 ,提供了以下两种基础类型 - 时间点(Time) - 时间段(Duration)

除此之外 golang 也提供��了以下类型,做一些特定的业务 - 时区(Location) - Ticker - Timer(定时器)

Variables

This section is empty.

Functions

func GetNow

func GetNow() string

func GetNow2TargetTime

func GetNow2TargetTime(targetTime time.Time) (time.Duration, error)

获取现在的时间 距离 目标时间之间 剩余时间段,

func GetTarget2NowTime

func GetTarget2NowTime(targetTime time.Time) (time.Duration, error)

获取过去时间 到 现在时间 的时间段

func GetTimeFormat

func GetTimeFormat(duration time.Duration) string

Truncate returns the result of rounding t down to a multiple of d (since the zero time). If d <= 0, Truncate returns t stripped of any monotonic clock reading but otherwise unchanged. 按照常规使用字符串 "yyyy-MM-dd HH:mm:ss" 来格式化时间.

func GetTimeRound

func GetTimeRound(duration time.Duration) (time.Time, error)

func GetTwoTimeSub

func GetTwoTimeSub(startime, endtime time.Time) (time.Duration, error)

返回两个时间段时间的 时间段

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL