Documentation ¶
Overview ¶
Package datetime 实现了一些格式化日期和时间的功能 Note: 1. `format` param in FormatTimeToStr function should be as flow: "yyyy-mm-dd hh:mm:ss" "yyyy-mm-dd hh:mm" "yyyy-mm-dd hh" "yyyy-mm-dd" "yyyy-mm" "mm-dd" "dd-mm-yy hh:mm:ss" "yyyy/mm/dd hh:mm:ss" "yyyy/mm/dd hh:mm" "yyyy/mm/dd hh" "yyyy/mm/dd" "yyyy/mm" "mm/dd" "dd/mm/yy hh:mm:ss" "yyyy" "mm" "hh:mm:ss" "mm:ss"
Index ¶
- func AddDay(t time.Time, day int64) time.Time
- func AddHour(t time.Time, hour int64) time.Time
- func AddMinute(t time.Time, minute int64) time.Time
- func BeginOfDay(t time.Time) time.Time
- func BeginOfHour(t time.Time) time.Time
- func BeginOfMinute(t time.Time) time.Time
- func BeginOfMonth(t time.Time) time.Time
- func BeginOfWeek(t time.Time) time.Time
- func BeginOfYear(t time.Time) time.Time
- func EndOfDay(t time.Time) time.Time
- func EndOfHour(t time.Time) time.Time
- func EndOfMinute(t time.Time) time.Time
- func EndOfMonth(t time.Time) time.Time
- func EndOfWeek(t time.Time) time.Time
- func EndOfYear(t time.Time) time.Time
- func FormatStrToTime(str, format string) (time.Time, error)
- func FormatTimeToStr(t time.Time, format string) string
- func GetNightTimestamp() int64
- func GetNowDate() string
- func GetNowDateTime() string
- func GetNowTime() string
- func GetZeroHourTimestamp() int64
- func NewFormat(t string) (*theTime, error)
- func NewISO8601(iso8601 string) (*theTime, error)
- func NewUnix(unix int64) *theTime
- func NewUnixNow() *theTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatStrToTime ¶
FormatStrToTime 将字符串转换为时间
func FormatTimeToStr ¶
FormatTimeToStr 将时间转换为字符串
func GetZeroHourTimestamp ¶
func GetZeroHourTimestamp() int64
GetZeroHourTimestamp 返回零时的时间戳 (时间戳为00:00)
func NewISO8601 ¶
NewISO8601 返回指定的iso8601时间字符串的unix时间戳
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.