Documentation ¶
Index ¶
- Constants
- func FormatDate(date time.Time) string
- func FormatDateWithLayout(date time.Time, layout string) string
- func GetMonthRange(date time.Time) (firstOfMonth, lastOfMonth time.Time)
- func GetWeekRange(date time.Time, firstDayOfWeek time.Weekday) (firstOfWeek, lastOfWeek time.Time)
- func ParseDate(val any) (result time.Time)
- func ParseDateRFC3339Nano(val any) (result time.Time)
- func ParseDateWithLayout(val any, layout string) (result time.Time)
Constants ¶
View Source
const ( DatetimeLayout = "2006-01-02 15:04:05" ZeroDateStr = "0001-01-01 00:00:00" // zero date )
Variables ¶
This section is empty.
Functions ¶
func FormatDate ¶
FormatDate 使用 "2006-01-02 15:04:05" 格式化日期
如果日期为 zero date(0001-01-01 00:00:00),返回 ""
func GetMonthRange ¶ added in v1.16.0
GetMonthRange 返回月开始(本月第一天零点)和月结束(下月第一天零点)
firstOfMonth <= date < lastOfMonth
func GetWeekRange ¶ added in v1.16.0
GetWeekRange firstDayOfWeek 用于指定每周的第一天,返回周开始(本周第一天零点)和周结束(下一周第一天零点)
firstOfWeek <= date < lastOfWeek
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.