Documentation
¶
Index ¶
- Constants
- func DayEnd(t time.Time) time.Time
- func DayStart(t time.Time) time.Time
- func Format(t time.Time) string
- func FormatWithLayout(t time.Time, layout string) string
- func FromMillis(msec int64) time.Time
- func FromSeconds(sec int64) time.Time
- func LastYearEnd() time.Time
- func LastYearStart() time.Time
- func MonthEnd(t time.Time) time.Time
- func MonthStart(t time.Time) time.Time
- func NowMicro() int64
- func NowMillis() int64
- func NowNanos() int64
- func NowSeconds() int64
- func ParseString(layout, value string) (time.Time, error)
- func ParseStringAuto(value string) (time.Time, error)
- func ThisMonthEnd() time.Time
- func ThisMonthStart() time.Time
- func ThisWeekEnd() time.Time
- func ThisWeekStart() time.Time
- func ThisYearEnd() time.Time
- func ThisYearStart() time.Time
- func TodayEnd() time.Time
- func TodayStart() time.Time
- func TomorrowEnd() time.Time
- func TomorrowStart() time.Time
- func WeekEnd(t time.Time) time.Time
- func WeekStart(t time.Time) time.Time
- func YearEnd(t time.Time) time.Time
- func YearStart(t time.Time) time.Time
- func YesterdayEnd() time.Time
- func YesterdayStart() time.Time
Constants ¶
View Source
const DateLayout = "2006-01-02"
View Source
const DateLayout2 = "2006.01.02"
View Source
const DateLayout3 = "20060102"
View Source
const DateLayout4 = "2006/01/02"
View Source
const DateLayout5 = "02/01/2006"
DateLayout5 "02/01/2006" 这个格式是有歧义的。 根据 Go 的解析规则,它代表 日/月/年。 但在美国,这个格式通常表示 月/日/年。
View Source
const DefaultLayout = "2006-01-02 15:04:05"
DefaultLayout 定义了最常用的时间格式
View Source
const DefaultLayout2 = "2006/01/02 15:04:05"
View Source
const DefaultLayout3 = "20060102150405"
View Source
const OnlyHourMinute = "15:04"
View Source
const OnlyTime = "15:04:05"
Variables ¶
This section is empty.
Functions ¶
func FormatWithLayout ¶
FormatWithLayout 自定义格式的format为字符串
func LastYearEnd ¶
func LastYearStart ¶
func ParseString ¶
ParseString 使用指定的布局和本地时区解析时间字符串
func ParseStringAuto ¶
ParseStringAuto 自动尝试多种常见格式来解析时间字符串 (使用本地时区)
func ThisMonthEnd ¶
func ThisMonthStart ¶
func ThisWeekEnd ¶
func ThisWeekStart ¶
func ThisYearEnd ¶
func ThisYearStart ¶
func TodayStart ¶
func TomorrowEnd ¶
func TomorrowStart ¶
func YesterdayEnd ¶
func YesterdayStart ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.