Documentation
¶
Index ¶
- Constants
- Variables
- func DaysCountOfMonth(year, month int) int
- func ElapsedDaysBetween(start, end time.Time) int
- func EndOfWeek(t time.Time) time.Time
- func FirstDayOfYear(year int) time.Time
- func FormatMsTime(ms int64) string
- func FormatMsTimeUTC(ms int64) string
- func FormatNanoTime(nano int64) string
- func FormatNanoTimeUTC(nano int64) string
- func FormatTime(t time.Time) string
- func FormatTimeUTC(t time.Time) string
- func GetNextMonday(now time.Time) time.Time
- func IsLeapYear(year int) bool
- func LastDayOfYear(year int) time.Time
- func MidnightTimeOf(t time.Time) time.Time
- func NextMidnight(ts int64) int64
- func ParseDuration(s string) (time.Duration, error)
- func PrettyDuration(d time.Duration) string
- func PrettyTime(ms int64) string
- func StartingOfWeek(t time.Time) time.Time
- func ThisMomentAfterDays(this time.Time, days int) time.Time
- func TimeOfMS(ms int64) time.Time
- func UTCTimeOfMS(ms int64) time.Time
- type Clock
Constants ¶
View Source
const ( ClockPrecision = time.Millisecond * 100 ISO8601Format = "2006-01-02T15:04:05-0700" )
View Source
const ( Day = 24 * time.Hour Week = 7 * Day )
View Source
const ( DateLayout = "2006-01-02T15:04:05" MsTimeLayout = "2006-01-02T15:04:05.000" MicroTimeLayout = "2006-01-02T15:04:05.000000" MsPerSecond = 1000 MsPerMinute = 60 * MsPerSecond MsPerHour = 60 * MsPerMinute MsPerDay = 24 * MsPerHour MsPerWeek = 7 * MsPerDay SecondsPerMin = 60 SecondsPerHour = 60 * SecondsPerMin SecondsPerDay = 24 * SecondsPerHour )
Variables ¶
View Source
var ( FirstDayIsMonday = false DefaultLoc = time.UTC )
Functions ¶
func ElapsedDaysBetween ¶
ElapsedDaysBetween 获取两个时间中经过的天数
func FormatMsTime ¶
func FormatMsTimeUTC ¶ added in v1.0.4
func FormatNanoTime ¶ added in v1.0.4
func FormatNanoTimeUTC ¶ added in v1.0.4
func FormatTime ¶
func FormatTimeUTC ¶ added in v1.0.4
func GetNextMonday ¶ added in v1.0.3
GetNextMonday 计算当前时间的下周一的凌晨0点
func ParseDuration ¶
ParseDuration parses a duration string, this extends `time.ParseDuration` with days A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d".
func PrettyDuration ¶
PrettyDuration returns a string representing the duration in the form of "4d2h3m5s".
func ThisMomentAfterDays ¶
ThisMomentAfterDays N天后的这个时候
func UTCTimeOfMS ¶ added in v1.0.10
Types ¶
Click to show internal directories.
Click to hide internal directories.