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/Shanghai" )
Variables ¶
var DefaultTimeLocation *time.Location
Functions ¶
func DayDifferenceHours ¶
DayDifferenceHours 两天之间相差了多少小时
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 获取区间时间内的日期字符串(比如:2023-05-23 2023-05-23) - 本月
func GetCurrentMonthRangeTime ¶
GetCurrentMonthRangeTime 获取区间时间 - 本月
func GetCurrentMonthRangeTimeString ¶
GetCurrentMonthRangeTimeString 获取区间时间内的时间字符串(比如:2023-05-23 00:00:00 2023-05-23 23:59:59) - 本月
func GetCurrentYearRangeDateString ¶
GetCurrentYearRangeDateString 获取区间时间内的日期字符串(比如:2023-05-23 2023-05-23) - 今年
func GetCurrentYearRangeTime ¶
GetCurrentYearRangeTime 获取区间时间 - 今年
func GetCurrentYearRangeTimeString ¶
GetCurrentYearRangeTimeString 获取区间时间内的时间字符串(比如:2023-05-23 00:00:00 2023-05-23 23:59:59) - 今年
func GetLastMonthRangeDateString ¶
GetLastMonthRangeDateString 获取区间时间内的日期字符串(比如:2023-05-23 2023-05-23) - 上个月
func GetLastMonthRangeTime ¶
GetLastMonthRangeTime 获取区间时间 - 上个月
func GetLastMonthRangeTimeString ¶
GetLastMonthRangeTimeString 获取区间时间内的时间字符串(比如:2023-05-23 00:00:00 2023-05-23 23:59:59) - 上个月
func GetLastYearRangeDateString ¶
GetLastYearRangeDateString 获取区间时间内的日期字符串(比如:2023-05-23 2023-05-23) - 去年
func GetLastYearRangeTime ¶
GetLastYearRangeTime 获取区间时间 - 去年
func GetLastYearRangeTimeString ¶
GetLastYearRangeTimeString 获取区间时间内的时间字符串(比如:2023-05-23 00:00:00 2023-05-23 23:59:59) - 去年
func GetTodayRangeDateString ¶
GetTodayRangeDateString 获取区间时间内的日期字符串(比如:2023-05-23 2023-05-23) - 今天
func GetTodayRangeTime ¶
GetTodayRangeTime 获取区间时间 - 今天
func GetTodayRangeTimeString ¶
GetTodayRangeTimeString 获取区间时间内的时间字符串(比如:2023-05-23 00:00:00 2023-05-23 23:59:59) - 今天
func GetYesterdayRangeDateString ¶
GetYesterdayRangeDateString 获取区间时间内的日期字符串(比如:2023-05-23 2023-05-23) - 昨天
func GetYesterdayRangeTime ¶
GetYesterdayRangeTime 获取区间时间 - 昨天
func GetYesterdayRangeTimeString ¶
GetYesterdayRangeTimeString 获取区间时间内的时间字符串(比如:2023-05-23 00:00:00 2023-05-23 23:59:59) - 昨天
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 两天之间相差了多少天
func StringDifferenceDays ¶
StringDifferenceDays 两天之间相差了多少天
func StringToUnixMilliInt64Ptr ¶
StringToUnixMilliInt64Ptr 字符串 -> 毫秒时间戳
func TimeDifferenceDays ¶
TimeDifferenceDays 两天之间相差了多少天
func TimeToTimestamppb ¶ added in v1.1.10
func TimeToTimestamppb(tm *time.Time) *timestamppb.Timestamp
TimeToTimestamppb time.Time -> timestamppb.Timestamp
func TimestamppbToTime ¶ added in v1.1.10
func TimestamppbToTime(tm *timestamppb.Timestamp) *time.Time
TimestamppbToTime timestamppb.Timestamp -> time.Time
func UnixMilliToStringPtr ¶
UnixMilliToStringPtr 毫秒时间戳 -> 字符串
Types ¶
This section is empty.