Documentation ¶
Index ¶
- Constants
- func After(d time.Duration) <-chan time.Time
- func Date(level int) string
- func DaySecond(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 WS() int64
- 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 YearWeekZero(year, week int) int64
- func Zero(num int) int64
- func ZeroTime(num int) time.Time
Constants ¶
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 Microsecond ¶ added in v0.33.6
Microsecond 获取微秒
func Millisecond ¶ added in v0.33.7
Millisecond 获取毫秒数
func NextWeekZero ¶
func NextWeekZero() int64
NextWeekZero 下一周第一天零点时间戳 eg: NextWeekZero() => 1546185600
func NextWeekZeroTime ¶
NextWeekZeroTime 下一周第一天零点时间 eg: NextWeekZeroTime() => 2018-12-31 00:00:00 +0800 CST
func SleepMillisecond ¶ added in v0.33.7
func SleepMillisecond(sleepMS int)
SleepMillisecond 暂停 sleepMS: 暂停毫秒数
func SleepMircosecond ¶ added in v0.33.7
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 WeekIndexByTime ¶
WeekIndexByTime 指定日期为一周的第几天,周一为第一天 返回 1|2|3|4|5|6|7
func WeekZeroTime ¶
WeekZeroTime 本周第一天零点时间 eg: WeekZeroTime() => 2018-12-24 00:00:00 +0800 CST
func YearWeekZero ¶
YearWeekZero 指定年,周 第一天的零点时间戳 eg: YearWeekZero(2019, 1) => 1546185600
Types ¶
This section is empty.