Documentation ¶
Index ¶
- Constants
- func Days(d time.Duration) float64
- func EndOfDay(t time.Time) time.Time
- func EndOfMonth(t time.Time) time.Time
- func EndOfQuarter(year int, q Quarter) time.Time
- func EndOfQuarter2(t time.Time) time.Time
- func EndOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time
- func EndOfYear(t time.Time) time.Time
- func IsLeapYear(year int) bool
- func MonthDays(year int, month time.Month) int
- func MonthDays2(t time.Time) int
- func NexEndOfMonth(t time.Time) time.Time
- func NextEndOfDay(t time.Time) time.Time
- func NextEndOfQuarter(year int, q Quarter) time.Time
- func NextEndOfQuarter2(t time.Time) time.Time
- func NextEndOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time
- func NextEndOfYear(t time.Time) time.Time
- func NextStartOfDay(t time.Time) time.Time
- func NextStartOfMonth(t time.Time) time.Time
- func NextStartOfQuarter(year int, q Quarter) time.Time
- func NextStartOfQuarter2(t time.Time) time.Time
- func NextStartOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time
- func NextStartOfYear(t time.Time) time.Time
- func PreviousEndOfDay(t time.Time) time.Time
- func PreviousEndOfMonth(t time.Time) time.Time
- func PreviousEndOfQuarter(year int, q Quarter) time.Time
- func PreviousEndOfQuarter2(t time.Time) time.Time
- func PreviousEndOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time
- func PreviousEndOfYear(t time.Time) time.Time
- func PreviousStartOfDay(t time.Time) time.Time
- func PreviousStartOfMonth(t time.Time) time.Time
- func PreviousStartOfQuarter(year int, q Quarter) time.Time
- func PreviousStartOfQuarter2(t time.Time) time.Time
- func PreviousStartOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time
- func PreviousStartOfYear(t time.Time) time.Time
- func StartOfDay(t time.Time) time.Time
- func StartOfMonth(t time.Time) time.Time
- func StartOfQuarter(year int, q Quarter) time.Time
- func StartOfQuarter2(t time.Time) time.Time
- func StartOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time
- func StartOfYear(t time.Time) time.Time
- func Valid(year, month, day int) bool
- func ValidMonth(month int) bool
- func ValidQuarter(q int) bool
- func ValidYear(year int) bool
- func YearDays(year int) int
- type Date
- type DateDot
- type DateMonth
- type DateMonthDot
- type DateMonthNop
- type DateMonthSlash
- func (t DateMonthSlash) MarshalJSON() ([]byte, error)
- func (t DateMonthSlash) MarshalText() ([]byte, error)
- func (t DateMonthSlash) StdTime() time.Time
- func (t DateMonthSlash) String() string
- func (t *DateMonthSlash) UnmarshalJSON(data []byte) error
- func (t *DateMonthSlash) UnmarshalText(text []byte) error
- type DateNop
- type DateSlash
- type Quarter
- type Time
- type TimeNop
- type UnixNanoTimestamp
- type UnixTimestamp
Constants ¶
const ( TimeLayout = "2006-01-02 15:04:05" TimeNopLayout = "20060102150405" DateLayout = "2006-01-02" DateSlashLayout = "2006/01/02" DateDotLayout = "2006.01.02" DateNopLayout = "20060102" DateMonthLayout = "2006-01" DateMonthSlashLayout = "2006/01" DateMonthDotLayout = "2006.01" DateMonthNopLayout = "200601" )
Variables ¶
This section is empty.
Functions ¶
func EndOfMonth ¶
EndOfMonth 获取时间中当月的结束时间. 2022-02-28 23:59:59.999999999 +0800 CST
func EndOfQuarter ¶ added in v0.1.0
EndOfQuarter 获取季度结束的时间 2022-03-31 23:59:59.999999999 +0800 CST
func EndOfQuarter2 ¶ added in v0.1.0
EndOfQuarter 获取时间的季度结束的时间 2022-03-31 23:59:59.999999999 +0800 CST
func NexEndOfMonth ¶ added in v0.1.0
NexEndOfMonth 获取时间中下月的结束时间. 2022-03-31 23:59:59.999999999 +0800 CST
func NextEndOfDay ¶ added in v0.1.0
NextEndOfDay 获取时间中下一天的结束时间. 2022-02-19 23:59:59.999999999 +0800 CST
func NextEndOfQuarter ¶ added in v0.1.0
NextEndOfQuarter 获取下一季度结束的时间 2022-06-31 23:59:59.999999999 +0800 CST
func NextEndOfQuarter2 ¶ added in v0.1.0
NextEndOfQuarter 获取时间的下一季度结束的时间 2022-06-31 23:59:59.999999999 +0800 CST
func NextEndOfWeek ¶ added in v0.1.0
NextEndOfWeek 获取时间当周的结束时间; weekStartDay 周几作为周的第一天,本库默认周一.
func NextEndOfYear ¶ added in v0.1.0
NextEndOfYear 获取日期中下一年的结束时间. 2023-12-31 23:59:59.999999999 +0800 CST
func NextStartOfDay ¶ added in v0.1.0
NextStartOfDay 获取时间中下一天的开始时间. 2022-02-19 00:00:00 +0800 CST
func NextStartOfMonth ¶ added in v0.1.0
NextStartOfMonth 获取时间中下月的开始时间. 2022-03-01 00:00:00 +0800 CST
func NextStartOfQuarter ¶ added in v0.1.0
NextStartOfQuarter 获取下个季度开始的时间 2022-04-01 00:00:00 +0800 CST
func NextStartOfQuarter2 ¶ added in v0.1.0
NextStartOfQuarter 获取时间的下个季度开始的时间 2022-04-01 00:00:00 +0800 CST
func NextStartOfWeek ¶ added in v0.1.0
NextStartOfWeek 获取时间下一周的开始时间; weekStartDay 周几作为周的第一天,本库默认周一.
func NextStartOfYear ¶ added in v0.1.0
NextStartOfYear 获取时间下一年的开始时间. 2023-01-01 00:00:00 +0800 CST
func PreviousEndOfDay ¶ added in v0.1.0
PreviousEndOfDay 获取时间中前一天的结束时间. 2022-02-17 23:59:59.999999999 +0800 CST
func PreviousEndOfMonth ¶ added in v0.1.0
PreviousEndOfMonth 获取时间中上月的结束时间. 2022-01-31 23:59:59.999999999 +0800 CST
func PreviousEndOfQuarter ¶ added in v0.1.0
PreviousEndOfQuarter 获取上一季度结束的时间 2022-12-31 23:59:59.999999999 +0800 CST
func PreviousEndOfQuarter2 ¶ added in v0.1.0
PreviousEndOfQuarter 获取时间的上一季度结束的时间 2022-12-31 23:59:59.999999999 +0800 CST
func PreviousEndOfWeek ¶ added in v0.1.0
PreviousEndOfWeek 获取时间上周的结束时间; weekStartDay 周几作为周的第一天,本库默认周一.
func PreviousEndOfYear ¶ added in v0.1.0
PreviousEndOfYear 获取时间上一年的结束时间. 2021-12-31 23:59:59.999999999 +0800 CST
func PreviousStartOfDay ¶ added in v0.1.0
PreviousStartOfDay 获取时间中上一天的开始时间. 2022-02-17 00:00:00 +0800 CST
func PreviousStartOfMonth ¶ added in v0.1.0
PreviousStartOfMonth 获取时间中上月的开始时间. 2022-01-01 00:00:00 +0800 CST
func PreviousStartOfQuarter ¶ added in v0.1.0
PreviousStartOfQuarter 获取上个季度开始的时间 2022-01-01 00:00:00 +0800 CST
func PreviousStartOfQuarter2 ¶ added in v0.1.0
PreviousStartOfQuarter 获取时间的上个季度开始的时间 2022-01-01 00:00:00 +0800 CST
func PreviousStartOfWeek ¶ added in v0.1.0
PreviousStartOfWeek 获取时间中上一周的开始时间; weekStartDay 周几作为周的第一天,本库默认周一.
func PreviousStartOfYear ¶ added in v0.1.0
PreviousStartOfYear 获取时间上一年的开始时间. 2023-01-01 00:00:00 +0800 CST
func StartOfDay ¶
StartOfDay 获取时间中当天的开始时间. 2022-02-18 00:00:00 +0800 CST
func StartOfMonth ¶
StartOfMonth 获取时间中当月的开始时间. 2022-02-01 00:00:00 +0800 CST
func StartOfQuarter ¶ added in v0.1.0
StartOfQuarter 获取季度开始的时间 q的值不为范围内的值, 返回第一季度值 2022-01-01 00:00:00 +0800 CST
func StartOfQuarter2 ¶ added in v0.1.0
StartOfQuarter2 获取时间季度开始的时间 2022-01-01 00:00:00 +0800 CST
func StartOfWeek ¶
StartOfWeek 获取时间当周的开始时间; weekStartDay 周几作为周的第一天,本库默认周一.
func StartOfYear ¶
StartOfYear 获取时间当年的开始时间. 2022-01-01 00:00:00 +0800 CST
Types ¶
type Date ¶
Date 格式: 2006-01-02
func (Date) MarshalJSON ¶ added in v0.1.0
MarshalJSON implemented interface Marshaler
func (Date) MarshalText ¶ added in v0.1.0
MarshalText implemented interface TextMarshaler
func (*Date) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON implemented interface Unmarshaler
func (*Date) UnmarshalText ¶ added in v0.1.0
UnmarshalText implemented interface TextUnmarshaler
type DateDot ¶ added in v0.1.0
DateDot 格式: 2006.01.02
func (DateDot) MarshalJSON ¶ added in v0.1.0
MarshalJSON implemented interface Marshaler
func (DateDot) MarshalText ¶ added in v0.1.0
MarshalText implemented interface TextMarshaler
func (*DateDot) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON implemented interface Unmarshaler
func (*DateDot) UnmarshalText ¶ added in v0.1.0
UnmarshalText implemented interface TextUnmarshaler
type DateMonth ¶ added in v0.1.0
DateMonth 格式: 2006-01
func ToDateMonth ¶ added in v0.1.0
ToDateMonth time.Time to DateMonth
func (DateMonth) MarshalJSON ¶ added in v0.1.0
MarshalJSON implemented interface Marshaler
func (DateMonth) MarshalText ¶ added in v0.1.0
MarshalText implemented interface TextMarshaler
func (*DateMonth) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON implemented interface Unmarshaler
func (*DateMonth) UnmarshalText ¶ added in v0.1.0
UnmarshalText implemented interface TextUnmarshaler
type DateMonthDot ¶ added in v0.1.0
DateMonthSlash 格式: 2006.01
func ToDateMonthDot ¶ added in v0.1.0
func ToDateMonthDot(t time.Time) DateMonthDot
ToDateMonthDot time.Time to DateMonthDot
func (DateMonthDot) MarshalJSON ¶ added in v0.1.0
func (t DateMonthDot) MarshalJSON() ([]byte, error)
MarshalJSON implemented interface Marshaler
func (DateMonthDot) MarshalText ¶ added in v0.1.0
func (t DateMonthDot) MarshalText() ([]byte, error)
MarshalText implemented interface TextMarshaler
func (DateMonthDot) StdTime ¶ added in v0.1.0
func (t DateMonthDot) StdTime() time.Time
StdTime convert to standard time
func (DateMonthDot) String ¶ added in v0.1.0
func (t DateMonthDot) String() string
String implemented interface Stringer
func (*DateMonthDot) UnmarshalJSON ¶ added in v0.1.0
func (t *DateMonthDot) UnmarshalJSON(data []byte) error
UnmarshalJSON implemented interface Unmarshaler
func (*DateMonthDot) UnmarshalText ¶ added in v0.1.0
func (t *DateMonthDot) UnmarshalText(text []byte) error
UnmarshalText implemented interface TextUnmarshaler
type DateMonthNop ¶ added in v0.1.0
DateMonthNop 格式: 200601
func ToDateMonthNop ¶ added in v0.1.0
func ToDateMonthNop(t time.Time) DateMonthNop
ToDateMonthNop time.Time to DateMonthNop
func (DateMonthNop) MarshalJSON ¶ added in v0.1.0
func (t DateMonthNop) MarshalJSON() ([]byte, error)
MarshalJSON implemented interface Marshaler
func (DateMonthNop) MarshalText ¶ added in v0.1.0
func (t DateMonthNop) MarshalText() ([]byte, error)
MarshalText implemented interface TextMarshaler
func (DateMonthNop) StdTime ¶ added in v0.1.0
func (t DateMonthNop) StdTime() time.Time
StdTime convert to standard time
func (DateMonthNop) String ¶ added in v0.1.0
func (t DateMonthNop) String() string
String implemented interface Stringer
func (*DateMonthNop) UnmarshalJSON ¶ added in v0.1.0
func (t *DateMonthNop) UnmarshalJSON(data []byte) error
UnmarshalJSON implemented interface Unmarshaler
func (*DateMonthNop) UnmarshalText ¶ added in v0.1.0
func (t *DateMonthNop) UnmarshalText(text []byte) error
UnmarshalText implemented interface TextUnmarshaler
type DateMonthSlash ¶ added in v0.1.0
DateMonthSlash 格式: 2006/01
func ToDateMonthSlash ¶ added in v0.1.0
func ToDateMonthSlash(t time.Time) DateMonthSlash
ToDateMonthSlash time.Time to DateMonthSlash
func (DateMonthSlash) MarshalJSON ¶ added in v0.1.0
func (t DateMonthSlash) MarshalJSON() ([]byte, error)
MarshalJSON implemented interface Marshaler
func (DateMonthSlash) MarshalText ¶ added in v0.1.0
func (t DateMonthSlash) MarshalText() ([]byte, error)
MarshalText implemented interface TextMarshaler
func (DateMonthSlash) StdTime ¶ added in v0.1.0
func (t DateMonthSlash) StdTime() time.Time
StdTime convert to standard time
func (DateMonthSlash) String ¶ added in v0.1.0
func (t DateMonthSlash) String() string
String implemented interface Stringer
func (*DateMonthSlash) UnmarshalJSON ¶ added in v0.1.0
func (t *DateMonthSlash) UnmarshalJSON(data []byte) error
UnmarshalJSON implemented interface Unmarshaler
func (*DateMonthSlash) UnmarshalText ¶ added in v0.1.0
func (t *DateMonthSlash) UnmarshalText(text []byte) error
UnmarshalText implemented interface TextUnmarshaler
type DateNop ¶ added in v0.1.0
DateNop 格式: 20060102
func (DateNop) MarshalJSON ¶ added in v0.1.0
MarshalJSON implemented interface Marshaler
func (DateNop) MarshalText ¶ added in v0.1.0
MarshalText implemented interface TextMarshaler
func (*DateNop) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON implemented interface Unmarshaler
func (*DateNop) UnmarshalText ¶ added in v0.1.0
UnmarshalText implemented interface TextUnmarshaler
type DateSlash ¶ added in v0.1.0
DateSlash 格式: 2006/01/02
func ToDateSlash ¶ added in v0.1.0
ToDateSlash time.Time to DateSlash
func (DateSlash) MarshalJSON ¶ added in v0.1.0
MarshalJSON implemented interface Marshaler
func (DateSlash) MarshalText ¶ added in v0.1.0
MarshalText implemented interface TextMarshaler
func (*DateSlash) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON implemented interface Unmarshaler
func (*DateSlash) UnmarshalText ¶ added in v0.1.0
UnmarshalText implemented interface TextUnmarshaler
type Quarter ¶ added in v0.1.0
type Quarter int
A Quarter specifies a quarter of the year (1, 2 , 3 ,4).
type Time ¶
Time 格式: 2006-01-02 15:04:05
func (Time) MarshalJSON ¶ added in v0.1.0
MarshalJSON implemented interface Marshaler
func (Time) MarshalText ¶ added in v0.1.0
MarshalText implemented interface TextMarshaler
func (*Time) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON implemented interface Unmarshaler
func (*Time) UnmarshalText ¶ added in v0.1.0
UnmarshalText implemented interface TextUnmarshaler
type TimeNop ¶ added in v0.1.0
TimeNop 格式: 20060102150405
func (TimeNop) MarshalJSON ¶ added in v0.1.0
MarshalJSON implemented interface Marshaler
func (TimeNop) MarshalText ¶ added in v0.1.0
MarshalText implemented interface TextMarshaler
func (*TimeNop) UnmarshalJSON ¶ added in v0.1.0
UnmarshalJSON implemented interface Unmarshaler
func (*TimeNop) UnmarshalText ¶ added in v0.1.0
UnmarshalText implemented interface TextUnmarshaler
type UnixNanoTimestamp ¶ added in v0.1.0
UnixNanoTimestamp unix nano 时间戳
func ToUnixNanoTimestamp ¶ added in v0.1.0
func ToUnixNanoTimestamp(t time.Time) UnixNanoTimestamp
ToUnixNanoTimestamp time.Time to UnixNanoTimestamp
func (UnixNanoTimestamp) MarshalJSON ¶ added in v0.1.0
func (t UnixNanoTimestamp) MarshalJSON() ([]byte, error)
MarshalJSON implemented interface Marshaler
func (UnixNanoTimestamp) StdTime ¶ added in v0.1.0
func (t UnixNanoTimestamp) StdTime() time.Time
StdTime convert to standard time
func (UnixNanoTimestamp) String ¶ added in v0.1.0
func (t UnixNanoTimestamp) String() string
String implemented interface Stringer
func (*UnixNanoTimestamp) UnmarshalJSON ¶ added in v0.1.0
func (t *UnixNanoTimestamp) UnmarshalJSON(data []byte) error
UnmarshalJSON implemented interface Unmarshaler
type UnixTimestamp ¶ added in v0.1.0
UnixTimestamp unix 时间戳
func ToUnixTimestamp ¶ added in v0.1.0
func ToUnixTimestamp(t time.Time) UnixTimestamp
ToUnixTimestamp time.Time to UnixTimestamp
func (UnixTimestamp) MarshalJSON ¶ added in v0.1.0
func (t UnixTimestamp) MarshalJSON() ([]byte, error)
MarshalJSON implemented interface Marshaler
func (UnixTimestamp) StdTime ¶ added in v0.1.0
func (t UnixTimestamp) StdTime() time.Time
Time convert to standard time
func (UnixTimestamp) String ¶ added in v0.1.0
func (t UnixTimestamp) String() string
String implemented interface Stringer
func (*UnixTimestamp) UnmarshalJSON ¶ added in v0.1.0
func (t *UnixTimestamp) UnmarshalJSON(data []byte) error
UnmarshalJSON implemented interface Unmarshaler