Documentation
¶
Overview ¶
Package timeutil contains some utility functions regarding time operations
Index ¶
- Constants
- func CurrentTimeStamp(nano ...bool) int64
- func CurrentTimeStampStr(nano ...bool) string
- func GetCurrentTimeStampMilli() int64
- func GetEndOfNatureMonth(timeStamp int64) (t time.Time)
- func GetEndOfNatureWeek(timeStamp int64) (t time.Time)
- func GetStartOfNatureMonth(timeStamp int64) (t time.Time)
- func GetStartOfNatureWeek(timeStamp int64) (t time.Time)
- func GetTimeStamp(year, month, day int, nano ...bool) int64
- func GetTimeStampFromTime(t time.Time) int64
- func NowUTC(addDuration ...time.Duration) time.Time
- func ParseDateMySQL(mySQLDateStr string) (t time.Time, err error)
- func ParseDateTimeISO8601(dateTimeStr string) (t time.Time, err error)
- func ParseDateTimeMySQL(mySQLDateTimeStr string) (t time.Time, err error)
- func ParseTimeStamp(timeStamp int64) (t time.Time)
- func ParseToTimeStamp(dateTimeStr string) (timeStamp int64, err error)
- func UniqueIDAcrossProcessNow() int64
Constants ¶
const FormatMySQLDate = "2006-01-02"
const FormatMySQLDateTime = "2006-01-02 15:04:05.999999"
const FormatMySQLDateTimeMicroseconds = "2006-01-02 15:04:05.000000"
const FormatMySQLDateTimeMilliseconds = "2006-01-02 15:04:05.000"
Variables ¶
This section is empty.
Functions ¶
func CurrentTimeStamp ¶
CurrentTimeStamp gets current timestamp in int64
func CurrentTimeStampStr ¶
CurrentTimeStampStr gets current timestamp in string
func GetCurrentTimeStampMilli ¶
func GetCurrentTimeStampMilli() int64
GetCurrentTimeStampMilli gets current timestamp in millis second in int64
func GetEndOfNatureMonth ¶
GetEndOfNatureMonth get the end time of the nature month the given time stamp belongs to
func GetEndOfNatureWeek ¶
GetEndOfNatureWeek get the end time of the nature week the given time stamp belongs to
func GetStartOfNatureMonth ¶
GetStartOfNatureMonth get the start time of the nature month the given time stamp belongs to
func GetStartOfNatureWeek ¶
GetStartOfNatureWeek get the start time of the nature week the given time stamp belongs to
func GetTimeStamp ¶
GetTimeStamp get timestamp in int64 by year, month and day.
func GetTimeStampFromTime ¶
Get timestamp from time.Time in millis second in int64
func ParseDateMySQL ¶
ParseDateMySQL parses a MySQL formatted date string into time.
func ParseDateTimeISO8601 ¶
ParseDateTimeISO8601 parses a ISO8601 formatted datetime string into time.
func ParseDateTimeMySQL ¶
ParseDateTimeMySQL parses a MySQL formatted datetime string into time.
func ParseTimeStamp ¶
ParseTimeStamp parses a timestamp given in seconds, milliseconds or nanoseconds into time.
func ParseToTimeStamp ¶
func UniqueIDAcrossProcessNow ¶
func UniqueIDAcrossProcessNow() int64
UniqueIDAcrossProcessNow returns a unique ID across all processes.
Types ¶
This section is empty.