Documentation ¶
Index ¶
- Constants
- Variables
- func DayDifferenceHours(startDate, endDate string) float64
- func DaySecondsDifferenceHours(startSecond, endSecond int64) float64
- func DayTimeDifferenceHours(startDate, endDate time.Time) float64
- func DurationHMS(d time.Duration) (int, int, int)
- func FormatTimer(d time.Duration) string
- func FormatTimerf(format string, d time.Duration) string
- func GetCurrentMonthRangeDateString() (string, string)
- func GetCurrentMonthRangeTime() (time.Time, time.Time)
- func GetCurrentMonthRangeTimeString() (string, string)
- func GetCurrentYearRangeDateString() (string, string)
- func GetCurrentYearRangeTime() (time.Time, time.Time)
- func GetCurrentYearRangeTimeString() (string, string)
- func GetLastMonthRangeDateString() (string, string)
- func GetLastMonthRangeTime() (time.Time, time.Time)
- func GetLastMonthRangeTimeString() (string, string)
- func GetLastYearRangeDateString() (string, string)
- func GetLastYearRangeTime() (time.Time, time.Time)
- func GetLastYearRangeTimeString() (string, string)
- func GetTodayRangeDateString() (string, string)
- func GetTodayRangeTime() (time.Time, time.Time)
- func GetTodayRangeTimeString() (string, string)
- func GetYesterdayRangeDateString() (string, string)
- func GetYesterdayRangeTime() (time.Time, time.Time)
- func GetYesterdayRangeTimeString() (string, string)
- func ReferenceTime() time.Time
- func RefreshDefaultTimeLocation(name string)
- func SecondsDifferenceDays(startSecond, endSecond int64) int
- func StringDateToTime(str *string) *time.Time
- func StringDifferenceDays(startDate, endDate string) int
- func StringTimeToTime(str *string) *time.Time
- func StringToUnixMilliInt64Ptr(tm *string) *int64
- func TimeDifferenceDays(startDate, endDate time.Time) int
- func TimeToDateString(tm *time.Time) *string
- func TimeToTimeString(tm *time.Time) *string
- func TimeToTimestamppb(tm *time.Time) *timestamppb.Timestamp
- func TimestamppbToTime(tm *timestamppb.Timestamp) *time.Time
- func UnixMilliToStringPtr(tm *int64) *string
Constants ¶
const ( DateLayout = "2006-01-02" ClockLayout = "15:04:05" TimeLayout = DateLayout + " " + ClockLayout DefaultTimeLocationName = "Asia/Ho_Chi_Minh" )
Variables ¶
var DefaultTimeLocation *time.Location
Functions ¶
func DayDifferenceHours ¶
DayDifferenceHours How many hours are there between the two days?
func DayTimeDifferenceHours ¶
func DurationHMS ¶
DurationHMS Extracts the hours, minutes, and seconds from the given duration.
func FormatTimer ¶
FormatTimer Formats the given duration in a colon-separated timer format in the form [HH:]MM:SS.
func FormatTimerf ¶
FormatTimerf Formats the given duration using the given format string. The string follows the same formatting rules as described in the fmt package, and will receive three integer arguments: hours, minutes, and seconds.
func GetCurrentMonthRangeDateString ¶
GetCurrentMonthRangeDateString Get the date string within the interval (for example: 2023-05-23 - 2023-05-23) - this month
func GetCurrentMonthRangeTime ¶
GetCurrentMonthRangeTime Get interval time - this month
func GetCurrentMonthRangeTimeString ¶
GetCurrentMonthRangeTimeString Get the time string within the interval (for example: 2023-05-23 00:00:00 2023-05-23 23:59:59) - this month
func GetCurrentYearRangeDateString ¶
GetCurrentYearRangeDateString Get the date string within the interval (for example: 2023-05-23 - 2023-05-23) - this year
func GetCurrentYearRangeTime ¶
GetCurrentYearRangeTime Get interval time - this year
func GetCurrentYearRangeTimeString ¶
GetCurrentYearRangeTimeString Get the time string within the interval (for example: 2023-05-23 00:00:00 2023-05-23 23:59:59) - this year
func GetLastMonthRangeDateString ¶
GetLastMonthRangeDateString Get the date string within the interval (for example: 2023-05-23 - 2023-05-23) - last month
func GetLastMonthRangeTime ¶
GetLastMonthRangeTime Get interval time - last month
func GetLastMonthRangeTimeString ¶
GetLastMonthRangeTimeString Get the time string within the interval (for example: 2023-05-23 00:00:00 2023-05-23 23:59:59) - last month
func GetLastYearRangeDateString ¶
GetLastYearRangeDateString Get the date string within the interval (for example: 2023-05-23 - 2023-05-23) - last year
func GetLastYearRangeTime ¶
GetLastYearRangeTime Get interval time - last year
func GetLastYearRangeTimeString ¶
GetLastYearRangeTimeString Get the time string within the interval (for example: 2023-05-23 00:00:00 2023-05-23 23:59:59) - last year
func GetTodayRangeDateString ¶
GetTodayRangeDateString Get the date string within the interval (for example: 2023-05-23 - 2023-05-23) - today
func GetTodayRangeTime ¶
GetTodayRangeTime Get interval time - today
func GetTodayRangeTimeString ¶
GetTodayRangeTimeString Get the time string within the interval (for example: 2023-05-23 00:00:00 2023-05-23 23:59:59) - today
func GetYesterdayRangeDateString ¶
GetYesterdayRangeDateString Get the date string within the interval (for example: 2023-05-23 - 2023-05-23) - yesterday
func GetYesterdayRangeTime ¶
GetYesterdayRangeTime Get interval time - yesterday
func GetYesterdayRangeTimeString ¶
GetYesterdayRangeTimeString Get the time string within the interval (for example: 2023-05-23 00:00:00 2023-05-23 23:59:59) - yesterday
func ReferenceTime ¶
ReferenceTime Return the standard Golang reference time (2006-01-02T15:04:05.999999999Z07:00)
func RefreshDefaultTimeLocation ¶
func RefreshDefaultTimeLocation(name string)
func SecondsDifferenceDays ¶
SecondsDifferenceDays How many days are there between the two days?
func StringDateToTime ¶
StringDateToTime Date string -> time
func StringDifferenceDays ¶
StringDifferenceDays How many days are there between the two days?
func StringTimeToTime ¶
StringTimeToTime time string -> time
func StringToUnixMilliInt64Ptr ¶
StringToUnixMilliInt64Ptr string -> millisecond timestamp
func TimeDifferenceDays ¶
TimeDifferenceDays How many days are there between the two days?
func TimeToDateString ¶
TimeToDateString Time -> date string
func TimeToTimeString ¶
TimeToTimeString Time -> time string
func TimeToTimestamppb ¶
func TimeToTimestamppb(tm *time.Time) *timestamppb.Timestamp
TimeToTimestamppb time.Time -> timestamppb.Timestamp
func TimestamppbToTime ¶
func TimestamppbToTime(tm *timestamppb.Timestamp) *time.Time
TimestamppbToTime timestamppb.Timestamp -> time.Time
func UnixMilliToStringPtr ¶
UnixMilliToStringPtr millisecond timestamp -> string
Types ¶
This section is empty.