Documentation ¶
Index ¶
- Constants
- func GetNow() string
- func GetNow2TargetTime(targetTime time.Time) (time.Duration, error)
- func GetTarget2NowTime(targetTime time.Time) (time.Duration, error)
- func GetTimeFormat(duration time.Duration) string
- func GetTimeRound(duration time.Duration) (time.Time, error)
- func GetTwoTimeSub(startime, endtime time.Time) (time.Duration, error)
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 GetNow2TargetTime ¶
获取现在的时间 距离 目标时间之间 剩余时间段,
func GetTarget2NowTime ¶
获取过去时间 到 现在时间 的时间段
func GetTimeFormat ¶
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" 来格式化时间.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.