Documentation ¶
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 AddYear(t time.Time, year 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, beginFrom ...time.Weekday) time.Time
- func BeginOfYear(t time.Time) time.Time
- func BetweenSeconds(t1 time.Time, t2 time.Time) int64
- func DayOfYear(t time.Time) int
- 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, endWith ...time.Weekday) time.Time
- func EndOfYear(t time.Time) time.Time
- func GetNightTimestamp() int64
- func GetNowDate() string
- func GetNowDateTime() string
- func GetNowTime() string
- func GetTodayEndTime() string
- func GetTodayStartTime() string
- func GetZeroHourTimestamp() int64
- func IsLeapYear(year int) bool
- func IsWeekend(t time.Time) bool
- func NewFormat(t string) (*theTime, error)
- func NewISO8601(iso8601 string) (*theTime, error)
- func NewUnix(unix int64) *theTime
- func NewUnixNow() *theTime
- func NowDateOrTime(format string, timezone ...string) string
- func NowTime(timezone ...string) time.Time
- func Strftime(t time.Time, format string, timezone ...string) string
- func Strptime(str, format string, timezone ...string) (time.Time, error)
- func Timestamp(timezone ...string) int64
- func TimestampMicro(timezone ...string) int64
- func TimestampMilli(timezone ...string) int64
- func TimestampNano(timezone ...string) int64
- func ToTimezone(t time.Time, timezone string) time.Time
- type GMT
- func (gmt GMT) Add(duration time.Duration) GMT
- func (gmt GMT) Format(layout string) string
- func (gmt GMT) MarshalJSON() ([]byte, error)
- func (gmt GMT) Scan(value interface{}) error
- func (gmt GMT) Sub(gmt2 GMT) time.Duration
- func (gmt *GMT) UnmarshalJSON(data []byte) error
- func (gmt GMT) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeginOfDay ¶
BeginOfDay return beginning hour time of day.
func BeginOfHour ¶
BeginOfHour return beginning hour time of day.
func BeginOfMinute ¶
BeginOfMinute return beginning minute time of day.
func BeginOfMonth ¶
BeginOfMonth return beginning of month.
func BeginOfWeek ¶
BeginOfWeek return beginning week, default week begin from Sunday.
func BeginOfYear ¶
BeginOfYear return the date time at the begin of year.
func BetweenSeconds ¶
BetweenSeconds returns the number of seconds between two times.
func EndOfMinute ¶
EndOfMinute return end minute time of day.
func GetNightTimestamp ¶
func GetNightTimestamp() int64
GetNightTimestamp return timestamp of zero hour (timestamp of 23:59).
func GetNowDateTime ¶
func GetNowDateTime() string
GetNowDateTime return format yyyy-mm-dd hh-mm-ss of current datetime.
func GetTodayEndTime ¶
func GetTodayEndTime() string
GetTodayEndTime return the end time of today, format: yyyy-mm-dd 23:59:59.
func GetTodayStartTime ¶
func GetTodayStartTime() string
GetTodayStartTime return the start time of today, format: yyyy-mm-dd 00:00:00.
func GetZeroHourTimestamp ¶
func GetZeroHourTimestamp() int64
GetZeroHourTimestamp return timestamp of zero hour (timestamp of 00:00).
func IsLeapYear ¶
IsLeapYear check if param year is leap year or not.
func IsWeekend ¶
IsWeekend checks if passed time is weekend or not. Deprecated Use '== Weekday' instead
func NewFormat ¶
NewFormat return unix timestamp of specified time string, t should be "yyyy-mm-dd hh:mm:ss".
func NewISO8601 ¶
NewISO8601 return unix timestamp of specified iso8601 time string.
func NowDateOrTime ¶
NowDateOrTime return current datetime with specific format and timezone.
func TimestampMicro ¶
TimestampMicro return current micro second timestamp.
func TimestampMilli ¶
TimestampMilli return current mill second timestamp.
func TimestampNano ¶
TimestampNano return current nano second timestamp.