Documentation ¶
Index ¶
- Constants
- func After(d time.Duration) <-chan time.Time
- func Date(level int) string
- func DaySeconds(days ...int) int64
- func FirstTimeOfWeek(year, week int) time.Time
- func Hour(hour int) time.Duration
- func MS() int64
- func Microsecond(microsecond int) time.Duration
- func Millisecond(millisecond int) time.Duration
- func Minute(minute int) time.Duration
- func Nano() int64
- func NextWeekZero() int64
- func NextWeekZeroTime() time.Time
- func Now() int64
- func Pass() int64
- func Remain() int64
- func Second(second int) time.Duration
- func Sleep(sleepSecond int)
- func SleepMillisecond(sleepMS int)
- func SleepMircosecond(sleepMicrosecond int)
- func Str2Now(dateString string) int64
- func Str2Time(dateString string) time.Time
- func ToString(timestamp int64, level int) string
- func TodayID() int
- func WS() int64
- func WeekID() int8
- func WeekIndex() int
- func WeekIndexByTime(t *time.Time) int
- func WeekPass() int64
- func WeekRemain() int64
- func WeekZero() int64
- func WeekZeroTime() time.Time
- func YearDay() int
- func YearWeek() (int, int)
- func YearWeekID() int
- func YearWeekZero(year, week int) int64
- func Zero(num int) int64
- func ZeroTime(num int) time.Time
Constants ¶
View Source
const ( // Y 2018 Y int = iota // YM 2018-12 YM // YM2 2018/12 YM2 // YM3 201812 YM3 // YMD 2018-12-31 YMD // YMD2 2018/12/31 YMD2 // YMD3 20181231 YMD3 // YMDHMS 2018-12-31 12:33:55 YMDHMS // YMDHMS2 2018/12/31 12:33:55 YMDHMS2 // YMDHMS3 20181231123355 YMDHMS3 // YMDHMSM 2018-12-31 12:33:55.332 YMDHMSM // DEFAULT 2018-12-31 00:03:27 DEFAULT )
Variables ¶
This section is empty.
Functions ¶
func FirstTimeOfWeek ¶
FirstTimeOfWeek 指定年,周 的第一天日期
代码来自于: https://xferion.com/golang-reverse-isoweek-get-the-date-of-the-first-day-of-iso-week/
eg: YearDay(2019, 1) => 2018-12-31 00:00:00 +0800 CST
func NextWeekZero ¶
func NextWeekZero() int64
NextWeekZero 下一周第一天零点时间戳
eg: NextWeekZero() => 1546185600
func NextWeekZeroTime ¶
NextWeekZeroTime 下一周第一天零点时间
eg: NextWeekZeroTime() => 2018-12-31 00:00:00 +0800 CST
func SleepMircosecond ¶
func SleepMircosecond(sleepMicrosecond int)
SleepMircosecond 暂停
sleepMicrosecond: 暂停微秒数
func Str2Now ¶
Str2Now 将字符串转为时间戳
param: dateString: YYYY-MM-DD hh:mm:ss
eg: Str2Now("2018-10-01 00:00:00") => 1538352000
func Str2Time ¶
Str2Time 将字符串转为时间
param: dateString YYYY-MM-DD hh:mm:ss
eg: Str2Time("2018-10-01 00:00:00") => 2018-10-01 00:00:00 +0000 UTC
func YearWeekID ¶ added in v0.23.6
func YearWeekID() int
YearWeekID 以本周是今年的第几周为编号
YearWeekID() => 202221
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.