Documentation
¶
Index ¶
- Constants
- func BeautyTimeStamp(timeStamp, currentTime int64) string
- func FromTodayToTomorrowTimeStamp() (today, tomorrow int64)
- func GetBetweenDateStrs(startDate, endDate string) []string
- func GetCST8Now() time.Time
- func GetISO8601(date int64) string
- func GetLastTimeStamp(d time.Time) time.Time
- func GetMonthDayStr(target time.Time) (string, string)
- func GetQuarterDayStr(target time.Time) (string, string)
- func GetWeekDayStr(target time.Time) (string, string)
- func GetZeroTimeStamp(d time.Time) time.Time
- func LastDayOfTimeStamp(d time.Time) int64
- func NowHyphenDateStr() string
- func NowHyphenTimeStr() string
- func NowHyphenTimeStrByDays(diffDays int) string
- type MyJsonTime
- func ParseFromHyphenDateStr(hyphenDateStr string) (newTime MyJsonTime, err error)
- func ParseFromHyphenDateStrWithLocation(hyphenDateStr string, location *time.Location) (jsonTime MyJsonTime, err error)
- func ParseFromHyphenTimeStr(hyphenTimeStr string) (newTime MyJsonTime, err error)
- func ParseFromHyphenTimeStrWithLocation(hyphenTimeStr string, location *time.Location) (jsonTime MyJsonTime, err error)
- func ParseFromPrueNumberDateTimeStr(timeStr string) (newTime MyJsonTime, err error)
- func ParseFromSlashDateStr(slashDateStr string) (newTime MyJsonTime, err error)
- func ParseFromSlashDateStrWithLocation(slashDateStr string, location *time.Location) (jsonTime MyJsonTime, err error)
- func ParseFromSlashTimeStr(slashTimeStr string) (newTime MyJsonTime, err error)
- func ParseFromSlashTimeStrWithLocation(slashTimeStr string, location *time.Location) (jsonTime MyJsonTime, err error)
- func (tm MyJsonTime) Add(duration time.Duration) MyJsonTime
- func (tm MyJsonTime) AddDate(years int, months int, days int) MyJsonTime
- func (tm MyJsonTime) After(target MyJsonTime) bool
- func (tm MyJsonTime) AfterOrEqual(target MyJsonTime) bool
- func (tm MyJsonTime) AfterOrEqualTime(target time.Time) bool
- func (tm MyJsonTime) AfterTime(target time.Time) bool
- func (tm MyJsonTime) Before(target MyJsonTime) bool
- func (tm MyJsonTime) BeforeOrEqual(target MyJsonTime) bool
- func (tm MyJsonTime) BeforeOrEqualTime(target time.Time) bool
- func (tm MyJsonTime) BeforeTime(target time.Time) bool
- func (tm MyJsonTime) Between(from, to MyJsonTime) bool
- func (tm MyJsonTime) BetweenOrEqual(from, to MyJsonTime) bool
- func (tm MyJsonTime) BetweenOrEqualTime(from, to time.Time) bool
- func (tm MyJsonTime) BetweenTime(from, to time.Time) bool
- func (tm MyJsonTime) Day() int
- func (tm MyJsonTime) Equal(target MyJsonTime) bool
- func (tm MyJsonTime) EqualTime(target time.Time) bool
- func (tm MyJsonTime) Format2Time() time.Time
- func (tm MyJsonTime) GetDateStr() string
- func (tm MyJsonTime) GetFirstDateOfWeek() (weekStartDate MyJsonTime)
- func (tm MyJsonTime) GetFirstTimeOfMonth() *MyJsonTime
- func (tm MyJsonTime) GetHyphenDateStr() string
- func (tm MyJsonTime) GetHyphenTimeStr() string
- func (tm MyJsonTime) GetHyphenTimeStrNoYear(yearNow int) string
- func (tm MyJsonTime) GetLastDateOfWeek() (weekStartDate MyJsonTime)
- func (tm MyJsonTime) GetLastTime() MyJsonTime
- func (tm MyJsonTime) GetLastTimeOfMonth() *MyJsonTime
- func (tm MyJsonTime) GetPureNumberStr() string
- func (tm MyJsonTime) GetSlashDateStr() string
- func (tm MyJsonTime) GetSlashTimeStr() string
- func (tm MyJsonTime) GetTimePoint() *time.Time
- func (tm MyJsonTime) GetTimeStr() string
- func (tm MyJsonTime) GetZeroTime() MyJsonTime
- func (tm MyJsonTime) Hour() int
- func (tm MyJsonTime) IsNull() bool
- func (tm MyJsonTime) Location() *time.Location
- func (tm MyJsonTime) MarshalJSON() ([]byte, error)
- func (tm MyJsonTime) Minute() int
- func (tm MyJsonTime) Month() time.Month
- func (tm MyJsonTime) Second() int
- func (tm MyJsonTime) SubIntDays(targetTime time.Time) int
- func (tm MyJsonTime) SubNowIntDays() int
- func (tm MyJsonTime) Unix() int64
- func (tm MyJsonTime) UnixNano() int64
- func (tm MyJsonTime) WeekdayInt() int
- func (tm MyJsonTime) WeekdayStrCn(style int) string
- func (tm MyJsonTime) WeekdayStrEn() string
- func (tm MyJsonTime) Year() int
Constants ¶
const ( TimeStr = "15:04:05" HyphenTimeStr = "2006-01-02 15:04:05" SlashTimeStr = "2006/01/02 15:04:05" HyphenDateStr = "2006-01-02" SlashDateStr = "2006/01/02" ISO8601TimeStr = "2006-01-02T15:04:05Z" PureNumber = "20060102150405" PureNumberDate = "20060102" HyphenTimeStrNoYear = "01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
func BeautyTimeStamp ¶
BeautyTimeStamp : 美化时间
func FromTodayToTomorrowTimeStamp ¶
func FromTodayToTomorrowTimeStamp() (today, tomorrow int64)
FromTodayToTomorrowTimeStamp : 返回今天凌晨和明天凌晨的时间戳
func GetBetweenDateStrs ¶ added in v1.5.6
GetBetweenDateStrs 根据开始日期和结束日期计算出时间段内所有日期 参数为日期格式,如:2020-01-01
func GetLastTimeStamp ¶ added in v1.5.6
GetLastTimeStamp : 获取某一天的最后时间
func GetMonthDayStr ¶ added in v1.5.6
GetMonthDayStr 获得当前月的初始和结束日期
func GetQuarterDayStr ¶ added in v1.5.6
GetQuarterDayStr 获得当前季度的初始和结束日期
func GetWeekDayStr ¶ added in v1.5.6
GetWeekDayStr 获得当前周的初始和结束日期
func LastDayOfTimeStamp ¶
LastDayOfTimeStamp : 获取本日最后一天的时间戳
func NowHyphenDateStr ¶ added in v1.5.6
func NowHyphenDateStr() string
func NowHyphenTimeStr ¶ added in v1.5.6
func NowHyphenTimeStr() string
func NowHyphenTimeStrByDays ¶ added in v1.5.6
NowHyphenTimeStrByDays 获取距离今天n天的日期
Types ¶
type MyJsonTime ¶ added in v1.5.6
func ParseFromHyphenDateStr ¶ added in v1.5.6
func ParseFromHyphenDateStr(hyphenDateStr string) (newTime MyJsonTime, err error)
ParseFromHyphenDateStr 从DateStr 转成 MyJsonTime "2006-01-02"
func ParseFromHyphenDateStrWithLocation ¶ added in v1.5.6
func ParseFromHyphenDateStrWithLocation(hyphenDateStr string, location *time.Location) (jsonTime MyJsonTime, err error)
ParseFromHyphenDateStrWithLocation 从DateStr 转成 MyJsonTime "2006-01-02"
func ParseFromHyphenTimeStr ¶ added in v1.5.6
func ParseFromHyphenTimeStr(hyphenTimeStr string) (newTime MyJsonTime, err error)
ParseFromHyphenTimeStr 从DateStr 转成 MyJsonTime "2006-01-02 15:04:05"
func ParseFromHyphenTimeStrWithLocation ¶ added in v1.5.6
func ParseFromHyphenTimeStrWithLocation(hyphenTimeStr string, location *time.Location) (jsonTime MyJsonTime, err error)
ParseFromHyphenTimeStrWithLocation 从DateStr 转成 MyJsonTime "2006-01-02 15:04:05"
func ParseFromPrueNumberDateTimeStr ¶ added in v1.5.6
func ParseFromPrueNumberDateTimeStr(timeStr string) (newTime MyJsonTime, err error)
ParseFromPrueNumberDateTimeStr 从DateStr 转成 MyJsonTime "20060102"
func ParseFromSlashDateStr ¶ added in v1.5.6
func ParseFromSlashDateStr(slashDateStr string) (newTime MyJsonTime, err error)
ParseFromSlashDateStr 从DateStr 转成 MyJsonTime "2006/01/02"
func ParseFromSlashDateStrWithLocation ¶ added in v1.5.6
func ParseFromSlashDateStrWithLocation(slashDateStr string, location *time.Location) (jsonTime MyJsonTime, err error)
ParseFromSlashDateStrWithLocation 从DateStr 转成 MyJsonTime "2006/01/02"
func ParseFromSlashTimeStr ¶ added in v1.5.6
func ParseFromSlashTimeStr(slashTimeStr string) (newTime MyJsonTime, err error)
ParseFromSlashTimeStr 从DateTimeStr 转成 MyJsonTime "2006/01/02 15:04:05"
func ParseFromSlashTimeStrWithLocation ¶ added in v1.5.6
func ParseFromSlashTimeStrWithLocation(slashTimeStr string, location *time.Location) (jsonTime MyJsonTime, err error)
ParseFromSlashTimeStrWithLocation 从DateTimeStr 转成 MyJsonTime "2006/01/02 15:04:05"
func (MyJsonTime) Add ¶ added in v1.5.6
func (tm MyJsonTime) Add(duration time.Duration) MyJsonTime
func (MyJsonTime) AddDate ¶ added in v1.5.6
func (tm MyJsonTime) AddDate(years int, months int, days int) MyJsonTime
func (MyJsonTime) After ¶ added in v1.5.6
func (tm MyJsonTime) After(target MyJsonTime) bool
After 在目标时间之后
func (MyJsonTime) AfterOrEqual ¶ added in v1.5.6
func (tm MyJsonTime) AfterOrEqual(target MyJsonTime) bool
func (MyJsonTime) AfterOrEqualTime ¶ added in v1.5.6
func (tm MyJsonTime) AfterOrEqualTime(target time.Time) bool
func (MyJsonTime) Before ¶ added in v1.5.6
func (tm MyJsonTime) Before(target MyJsonTime) bool
Before 在目标时间之前
func (MyJsonTime) BeforeOrEqual ¶ added in v1.5.6
func (tm MyJsonTime) BeforeOrEqual(target MyJsonTime) bool
func (MyJsonTime) BeforeOrEqualTime ¶ added in v1.5.6
func (tm MyJsonTime) BeforeOrEqualTime(target time.Time) bool
func (MyJsonTime) BeforeTime ¶ added in v1.5.6
func (tm MyJsonTime) BeforeTime(target time.Time) bool
func (MyJsonTime) Between ¶ added in v1.5.6
func (tm MyJsonTime) Between(from, to MyJsonTime) bool
Between 在两个时间中间,注意前面那个一定要小一点
func (MyJsonTime) BetweenOrEqual ¶ added in v1.5.6
func (tm MyJsonTime) BetweenOrEqual(from, to MyJsonTime) bool
func (MyJsonTime) BetweenOrEqualTime ¶ added in v1.5.6
func (tm MyJsonTime) BetweenOrEqualTime(from, to time.Time) bool
func (MyJsonTime) BetweenTime ¶ added in v1.5.6
func (tm MyJsonTime) BetweenTime(from, to time.Time) bool
func (MyJsonTime) Day ¶ added in v1.5.6
func (tm MyJsonTime) Day() int
func (MyJsonTime) Equal ¶ added in v1.5.6
func (tm MyJsonTime) Equal(target MyJsonTime) bool
Equal 与目标时间相同
func (MyJsonTime) Format2Time ¶ added in v1.5.6
func (tm MyJsonTime) Format2Time() time.Time
func (MyJsonTime) GetDateStr ¶ added in v1.5.6
func (tm MyJsonTime) GetDateStr() string
GetDateStr 获取短横线 日期 字符串
func (MyJsonTime) GetFirstDateOfWeek ¶ added in v1.5.6
func (tm MyJsonTime) GetFirstDateOfWeek() (weekStartDate MyJsonTime)
GetFirstDateOfWeek 获取本周周一的日期
func (MyJsonTime) GetFirstTimeOfMonth ¶ added in v1.5.6
func (tm MyJsonTime) GetFirstTimeOfMonth() *MyJsonTime
GetFirstTimeOfMonth 获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
func (MyJsonTime) GetHyphenDateStr ¶ added in v1.5.6
func (tm MyJsonTime) GetHyphenDateStr() string
GetHyphenDateStr 获取 短横线 日期 字符串
func (MyJsonTime) GetHyphenTimeStr ¶ added in v1.5.6
func (tm MyJsonTime) GetHyphenTimeStr() string
GetHyphenTimeStr 获取 短横线 日期+时间 字符串
func (MyJsonTime) GetHyphenTimeStrNoYear ¶ added in v1.5.6
func (tm MyJsonTime) GetHyphenTimeStrNoYear(yearNow int) string
GetHyphenTimeStrNoYear 如果今年是今年,去掉今年(哲学)
func (MyJsonTime) GetLastDateOfWeek ¶ added in v1.5.6
func (tm MyJsonTime) GetLastDateOfWeek() (weekStartDate MyJsonTime)
GetLastDateOfWeek 获取本周周日的日期
func (MyJsonTime) GetLastTime ¶ added in v1.5.6
func (tm MyJsonTime) GetLastTime() MyJsonTime
GetLastTime 获取某一天的最后时间
func (MyJsonTime) GetLastTimeOfMonth ¶ added in v1.5.6
func (tm MyJsonTime) GetLastTimeOfMonth() *MyJsonTime
GetLastTimeOfMonth 获取传入的时间所在月份的最后天,即某月最后一天的23点59分59秒
func (MyJsonTime) GetPureNumberStr ¶ added in v1.5.6
func (tm MyJsonTime) GetPureNumberStr() string
GetPureNumberStr 获取 纯数字 年月日时分秒
func (MyJsonTime) GetSlashDateStr ¶ added in v1.5.6
func (tm MyJsonTime) GetSlashDateStr() string
GetSlashDateStr 获取 斜杠 日期 字符串
func (MyJsonTime) GetSlashTimeStr ¶ added in v1.5.6
func (tm MyJsonTime) GetSlashTimeStr() string
GetSlashTimeStr 获取 斜杠 日期+时间 字符串
func (MyJsonTime) GetTimePoint ¶ added in v1.5.6
func (tm MyJsonTime) GetTimePoint() *time.Time
GetTimePoint 获取时间指针类型
func (MyJsonTime) GetTimeStr ¶ added in v1.5.6
func (tm MyJsonTime) GetTimeStr() string
GetTimeStr 获取 时间 字符串
func (MyJsonTime) GetZeroTime ¶ added in v1.5.6
func (tm MyJsonTime) GetZeroTime() MyJsonTime
GetZeroTime 获取某一天的0点时间
func (MyJsonTime) Hour ¶ added in v1.5.6
func (tm MyJsonTime) Hour() int
func (MyJsonTime) Location ¶ added in v1.5.6
func (tm MyJsonTime) Location() *time.Location
func (MyJsonTime) MarshalJSON ¶ added in v1.5.6
func (tm MyJsonTime) MarshalJSON() ([]byte, error)
MarshalJSON 实现它的json序列化方法
func (MyJsonTime) Minute ¶ added in v1.5.6
func (tm MyJsonTime) Minute() int
func (MyJsonTime) Month ¶ added in v1.5.6
func (tm MyJsonTime) Month() time.Month
func (MyJsonTime) Second ¶ added in v1.5.6
func (tm MyJsonTime) Second() int
func (MyJsonTime) SubIntDays ¶ added in v1.5.6
func (tm MyJsonTime) SubIntDays(targetTime time.Time) int
SubIntDays 获取与目标时间相差的整数天
func (MyJsonTime) SubNowIntDays ¶ added in v1.5.6
func (tm MyJsonTime) SubNowIntDays() int
SubNowIntDays 获取与今天相差的整数天
func (MyJsonTime) Unix ¶ added in v1.5.6
func (tm MyJsonTime) Unix() int64
func (MyJsonTime) UnixNano ¶ added in v1.5.6
func (tm MyJsonTime) UnixNano() int64
func (MyJsonTime) WeekdayInt ¶ added in v1.5.6
func (tm MyJsonTime) WeekdayInt() int
func (MyJsonTime) WeekdayStrCn ¶ added in v1.5.6
func (tm MyJsonTime) WeekdayStrCn(style int) string
WeekdayStrCn 返回中文星期
func (MyJsonTime) WeekdayStrEn ¶ added in v1.5.6
func (tm MyJsonTime) WeekdayStrEn() string
WeekdayStrEn 返回英文星期
func (MyJsonTime) Year ¶ added in v1.5.6
func (tm MyJsonTime) Year() int