Documentation ¶
Index ¶
- Constants
- Variables
- func CountMonthLeftDay(t time.Time, loc *time.Location) int
- func DateFormatInUtc2(t time.Time) string
- func DateStringToTimeInDefault(s string) (t time.Time, err error)
- func DateSub(t1 time.Time, t2 time.Time, loc *time.Location) time.Duration
- func DateSubLocal(t1 time.Time, t2 time.Time) time.Duration
- func DateSubToDay(t1 time.Time, t2 time.Time, loc *time.Location) int
- func DateSubToHour(t1 time.Time, t2 time.Time, loc *time.Location) int
- func DbTimeGetMaxValue() string
- func DbTimeGetMinValue() string
- func DbTimeGetObjFromString(s string) (t time.Time, err error)
- func DbTimeGetObjFromStringIgnoreError(s string) time.Time
- func DbTimeGetObjFromUint64(u uint64) (t time.Time)
- func DbTimeGetObjFromUint64Second(u uint64) (t time.Time)
- func DbTimeGetStringFromObj(t time.Time) string
- func DbTimeGetStringFromObjV2(t time.Time) string
- func DbTimeGetUint64FromObjOrMax(t time.Time) uint64
- func DbTimeGetUint64SecondFromObj(t time.Time) uint64
- func DefaultAgeFormat(targetTime time.Time, now time.Time) string
- func DefaultDateFormat(t time.Time) string
- func DefaultFormat(t time.Time) string
- func DefaultFormatLocal(t time.Time) string
- func DefaultFormatNs(t time.Time) string
- func DefaultFormatNsFixSize(t time.Time) string
- func DefaultFormatSecondV2(t time.Time) string
- func DefaultMysqlFormat(t time.Time) string
- func DefaultTimeAndAgeFormat(targetTime time.Time, now time.Time) string
- func DurationFormat(dur time.Duration) string
- func DurationFormatBefore(dur time.Duration) string
- func DurationFormatByHourMin(dur time.Duration) string
- func DurationFormatFloat64Ns(dur float64) string
- func DurationFormatFloat64Seconds(dur float64) string
- func DurationFormatPadding(dur time.Duration) string
- func DurationFormatTimeMysql(dur time.Duration) string
- func FixClockTimeSleep(dur time.Duration)
- func FixClockTimeSleepToTimeInDay(offset time.Duration, zone *time.Location)
- func FixClockTimeSleepToTimeInDayInDefaultTimeZone(offset time.Duration)
- func FixClockTimeSleepWithOffset(dur time.Duration, offset time.Duration)
- func FixLocalTimeToOffsetSpecifiedZoneTime(timeOffset int, localTime string) string
- func FormatDefaultRfc3339(t time.Time) string
- func FormatMysqlMinuteInTz(t time.Time, tz *time.Location) string
- func FormatRfc3339NanoNoTz(t time.Time) string
- func FormatTimeZone(tz *time.Location) string
- func FromUnixFloat(f float64) time.Time
- func FromUnixInt64(f int64) time.Time
- func FromUnixMillisecondsInt64(f int64) time.Time
- func FromUnixNano(f uint64) time.Time
- func FromUnixNanoInt64(f int64) time.Time
- func GetDefaultTimeZone() *time.Location
- func GetDurToNextWeek(weekday time.Weekday, hour int) time.Duration
- func GetDurationToNextWeek(weekday time.Weekday, offset time.Duration) time.Duration
- func GetFixedZoneByTzSecond(locOffset int) *time.Location
- func GetLastWeek(weekday time.Weekday, sometime time.Time) time.Time
- func GetMaxTime() time.Time
- func GetNextTimeDuration(hour int, minute int) time.Duration
- func GetNextWeek(weekday time.Weekday, sometime time.Time) time.Time
- func GetPeriodFromGenericSortedList(t time.Time, SortedList interface{}) (index int, err error)
- func GetPeriodFromSortedList(t time.Time, SortedList []Period) (index int, ok bool)
- func GetSubSeconds(a time.Time, b time.Time) int64
- func GetThisWeek(weekday time.Weekday, sometime time.Time) time.Time
- func GetTimePointInBetween(req GetTimePointInBetweenRequest) int
- func GetUnixFloat(t1 time.Time) float64
- func GetUtc2Zone() *time.Location
- func GetUtc8Zone() *time.Location
- func GetUtcD4Zone() *time.Location
- func GetUtcD5Zone() *time.Location
- func GetUtcD7Zone() *time.Location
- func GetUtcD8Zone() *time.Location
- func HourAndMinuteFormatLocal(t time.Time) string
- func IsSameDay(t1 time.Time, t2 time.Time, loc *time.Location) bool
- func IsSameHour(t1 time.Time, t2 time.Time, loc *time.Location) bool
- func IsSameMonth(t1 time.Time, t2 time.Time, loc *time.Location) bool
- func ModBySecond(t1 time.Time) time.Time
- func MonthAndDayFormat(t time.Time) string
- func MonthDayYearFormat(t time.Time) string
- func MonthLeftPercent(t time.Time, loc *time.Location) float64
- func MustDateMysqlFormat(t string)
- func MustDateStringAddDay(s string, dayNum int) string
- func MustDateStringSubToDay(s1 string, s2 string) int
- func MustDateStringToTime(s string, tz *time.Location) (t time.Time)
- func MustDbTimeDescGetObjFromString(s string) (t time.Time)
- func MustDbTimeDescGetStringFromObj(t time.Time) string
- func MustDbTimeGetObjFromString(s string) time.Time
- func MustDbTimeGetObjFromStringIgnoreEmpty(s string) time.Time
- func MustDbTimeGetStringFromObj(t time.Time) string
- func MustDbTimeHourGetObjFromString(s string) time.Time
- func MustDbTimeHourGetStringFromObj(t time.Time) string
- func MustDbTimeSecondGetStringFromObj(t time.Time) string
- func MustFromLocalMysqlFormat(timeString string) time.Time
- func MustFromMysqlDateFormat(timeString string) time.Time
- func MustFromMysqlFormat(timeString string) time.Time
- func MustFromMysqlFormatDefaultTZ(timeString string) time.Time
- func MustFromMysqlFormatInLocation(timeString string, loc *time.Location) time.Time
- func MustNotTimeout(f func(), dur time.Duration)
- func MustParseAutoInDefault(sTime string) (t time.Time)
- func MustParseAutoInDefaultIgnoreEmpty(sTime string) (t time.Time)
- func MustParseAutoInLocal(sTime string) (t time.Time)
- func MustParseAutoInUTC(sTime string) (t time.Time)
- func MustParseFormatDateMysqlInDefaultTz(tS string) (t time.Time)
- func MustParseFormatDateMysqlInTz(tS string, tz *time.Location) (t time.Time)
- func MustSplitMysqlDateFormatPrefix(s string) (datePart string, remainPart string)
- func MysqlNowFromDefaultNower() string
- func MysqlUsFormat(t time.Time) string
- func MysqlUsNowFromDefaultNower() string
- func NowFromDefaultNower() (out time.Time)
- func NowWithFileNameFormatV2() string
- func ParseAutoInDefault(sTime string) (t time.Time, err error)
- func ParseAutoInLocal(sTime string) (t time.Time, err error)
- func ParseAutoInLocation(sTime string, loc *time.Location) (t time.Time, err error)
- func ParseFormatDateMysqlInDefaultTz(tS string) (t time.Time, errMsg string)
- func ParseMillStringToTime(mill string) (time.Time, error)
- func PeriodListSort(PeriodList PeriodListInterface)
- func PeriodSort(p []Period)
- func PstTimeZoneDateFormat(t time.Time) string
- func SelectPeriodFromSortedPeriodList(t time.Time, PeriodList PeriodListInterface) (index int, ok bool)
- func SetDefaultNowerCallback(cb func() time.Time)
- func SetDefaultNowerToFixTime(t time.Time)
- func SetDefaultNowerToFixTimeString(s string)
- func SetDefaultNowerToOffset(offset time.Duration)
- func SetDefaultNowerToRealTime()
- func SleepLoopWithFixDuration(req FixTimeDurationLoopRequest)
- func SleepToTodayTimePoint(now time.Time, d time.Duration)
- func TimeIntSecConvert(sec int) string
- func Timeout(f func(), dur time.Duration) (hasTimeout bool)
- func ToDate(t time.Time) time.Time
- func ToDateDefault(t time.Time) time.Time
- func ToDateString(t time.Time) string
- func ToDateStringInDefaultTz(t time.Time) string
- func ToLocal(t time.Time) time.Time
- func ToMonth(t time.Time, loc *time.Location) time.Time
- func ToMonthWithOffset(t time.Time, loc *time.Location, offset int) time.Time
- func UdwLogFormat(t time.Time) string
- func UnixNanoNow() int64
- func YearMonthFormat(t time.Time) string
- type DateStringPeriod
- type FixTimeDurationLoopRequest
- type GetTimePointInBetweenRequest
- type MonthDate
- type Period
- type PeriodGetter
- type PeriodHour
- type PeriodList
- func (p PeriodList) Append(period Period) PeriodList
- func (p PeriodList) IsIncludeOverlap() bool
- func (p PeriodList) Len() int
- func (p PeriodList) Less(i, j int) bool
- func (p PeriodList) SelectFromTime(t time.Time) (OriginIndex int, ok bool)
- func (p PeriodList) SetAtIndex(period Period, i int)
- func (p PeriodList) Sort()
- func (p PeriodList) Swap(i, j int)
- type PeriodListElement
- type PeriodListInterface
- type PeriodSlice
- type TimeRecoverInt
- type TtlStringTimeMap
Constants ¶
View Source
const ( FormatMysqlZero = "0000-00-00 00:00:00" FormatMysql = "2006-01-02 15:04:05" FormatMysqlUs = "2006-01-02 15:04:05.999999" FormatMysqlNs = "2006-01-02T15:04:05.999999999" FormatMysqlNsV2 = "2006-01-02 15:04:05.999999999" FormatMysqlNsV3 = "2006-01-02T15-04-05.999999999" FormatFileName = "2006-01-02_15-04-05" FormatFileNameV2 = "2006-01-02-15-04-05" FormatDateMysql = "2006-01-02" FormatMysqlDate = "2006-01-02" FormatZoneOffsetMysql = "2006-01-02 15:04:05 -0700" FormatZoneOffsetMysqlV2 = "2006-01-02 15:04:05 -0700 CST" Iso3339Hour = "2006-01-02T15" Iso3339Minute = "2006-01-02T15:04" Iso3339Second = "2006-01-02T15:04:05" FormatDbTimeSecond = Iso3339Second AppleJsonFormat = "2006-01-02 15:04:05 Etc/MST" AppleJsonFormatV2 = "2006-01-02 15:04:05 MST" Iso8601 = "2006-01-02T15:04Z" Iso8601GMT = "2006-01-02T15:04:05Z" FormatMysqlMinute = "2006-01-02 15:04" FormatMysqlMouthAndDay = "01-02" FormatMysqlYearAndMoney = "2006-01" FormatInternational = "Monday, 02 January 2006" FormatHourAndMinute = "15:04" FormatMouthDayHourAndMinute = "01-02 15:04" FormatDateAndHour = "2006-01-02 15" FormatUdwLog = "20060102T15:04:05.000000-07" FormatDateTimeDigitalSecond = "20060102150405" )
View Source
const ( Day = 24 * time.Hour Month = 30 * Day Year = 365 * Day YearSecond = 365 * 24 * 60 * 60 WeekSecond = 7 * 24 * 60 * 60 )
Variables ¶
View Source
var DefaultNower tDefaultNower
View Source
var MysqlEnd = "9999-12-31 23:59:59"
View Source
var MysqlStart = "0000-01-01 00:00:00"
View Source
var ParseFormatGuessList = []string{ FormatFileNameV2, FormatMysqlZero, FormatMysql, FormatDateMysql, FormatZoneOffsetMysqlV2, Iso3339Hour, Iso3339Minute, Iso3339Second, time.RFC3339, time.RFC3339Nano, Iso8601, Iso8601GMT, }
Functions ¶
func DateFormatInUtc2 ¶
func DbTimeGetMaxValue ¶
func DbTimeGetMaxValue() string
func DbTimeGetMinValue ¶
func DbTimeGetMinValue() string
func DbTimeGetObjFromUint64 ¶
func DbTimeGetStringFromObj ¶
func DefaultDateFormat ¶
func DefaultFormat ¶
func DefaultFormatLocal ¶
func DefaultFormatNs ¶
func DefaultFormatNsFixSize ¶
func DefaultFormatSecondV2 ¶
func DefaultMysqlFormat ¶
func DefaultTimeAndAgeFormat ¶
func DurationFormat ¶
func DurationFormatBefore ¶
func DurationFormatByHourMin ¶
func DurationFormatFloat64Ns ¶
func DurationFormatPadding ¶
func DurationFormatTimeMysql ¶
func FixClockTimeSleep ¶
func FormatDefaultRfc3339 ¶
func FormatRfc3339NanoNoTz ¶
func FormatTimeZone ¶
func FromUnixFloat ¶
func FromUnixInt64 ¶
func FromUnixNano ¶
func FromUnixNanoInt64 ¶
func GetDefaultTimeZone ¶
func GetDurationToNextWeek ¶
func GetFixedZoneByTzSecond ¶
func GetMaxTime ¶
func GetPeriodFromSortedList ¶
func GetTimePointInBetween ¶
func GetTimePointInBetween(req GetTimePointInBetweenRequest) int
func GetUnixFloat ¶
func GetUtc2Zone ¶
func GetUtc8Zone ¶
func GetUtcD4Zone ¶
func GetUtcD5Zone ¶
func GetUtcD7Zone ¶
func GetUtcD8Zone ¶
func MonthAndDayFormat ¶
func MonthDayYearFormat ¶
func MustDateMysqlFormat ¶
func MustDateMysqlFormat(t string)
func MustDateStringAddDay ¶
func MustDateStringSubToDay ¶
func MustFromMysqlDateFormat ¶
func MustFromMysqlFormat ¶
func MustNotTimeout ¶
func MustParseAutoInDefault ¶
func MustParseAutoInLocal ¶
func MustParseAutoInUTC ¶
func MysqlNowFromDefaultNower ¶
func MysqlNowFromDefaultNower() string
func MysqlUsFormat ¶
func MysqlUsNowFromDefaultNower ¶
func MysqlUsNowFromDefaultNower() string
func NowFromDefaultNower ¶
func NowWithFileNameFormatV2 ¶
func NowWithFileNameFormatV2() string
func ParseAutoInLocation ¶
func PeriodListSort ¶
func PeriodListSort(PeriodList PeriodListInterface)
func PeriodSort ¶
func PeriodSort(p []Period)
func PstTimeZoneDateFormat ¶
func SelectPeriodFromSortedPeriodList ¶
func SelectPeriodFromSortedPeriodList(t time.Time, PeriodList PeriodListInterface) (index int, ok bool)
func SetDefaultNowerCallback ¶
func SetDefaultNowerToFixTimeString ¶
func SetDefaultNowerToFixTimeString(s string)
func SetDefaultNowerToOffset ¶
func SetDefaultNowerToRealTime ¶
func SetDefaultNowerToRealTime()
func SleepLoopWithFixDuration ¶
func SleepLoopWithFixDuration(req FixTimeDurationLoopRequest)
func TimeIntSecConvert ¶
func ToDateString ¶
func ToDateStringInDefaultTz ¶
func ToMonthWithOffset ¶
func UdwLogFormat ¶
func UnixNanoNow ¶
func UnixNanoNow() int64
func YearMonthFormat ¶
Types ¶
type DateStringPeriod ¶
type Period ¶
func GetOneWeekPeriodArray ¶
func NewPeriodPassed24Hours ¶
func NewPeriodPassed24Hours() Period
type PeriodGetter ¶
type PeriodGetter interface {
GetPeriod() Period
}
type PeriodHour ¶
type PeriodList ¶
type PeriodList []PeriodListElement
func (PeriodList) Append ¶
func (p PeriodList) Append(period Period) PeriodList
func (PeriodList) IsIncludeOverlap ¶
func (p PeriodList) IsIncludeOverlap() bool
func (PeriodList) Len ¶
func (p PeriodList) Len() int
func (PeriodList) Less ¶
func (p PeriodList) Less(i, j int) bool
func (PeriodList) SelectFromTime ¶
func (p PeriodList) SelectFromTime(t time.Time) (OriginIndex int, ok bool)
func (PeriodList) SetAtIndex ¶
func (p PeriodList) SetAtIndex(period Period, i int)
func (PeriodList) Sort ¶
func (p PeriodList) Sort()
func (PeriodList) Swap ¶
func (p PeriodList) Swap(i, j int)
type PeriodListElement ¶
type PeriodListInterface ¶
type PeriodSlice ¶
type PeriodSlice []Period
func (PeriodSlice) Len ¶
func (p PeriodSlice) Len() int
func (PeriodSlice) Less ¶
func (p PeriodSlice) Less(i, j int) bool
func (PeriodSlice) Swap ¶
func (p PeriodSlice) Swap(i, j int)
type TimeRecoverInt ¶
func (*TimeRecoverInt) Full ¶
func (t *TimeRecoverInt) Full(now time.Time)
func (*TimeRecoverInt) Sync ¶
func (t *TimeRecoverInt) Sync(now time.Time)
type TtlStringTimeMap ¶
type TtlStringTimeMap struct {
// contains filtered or unexported fields
}
func TtlStringTimeMapNew ¶
func TtlStringTimeMapNew(ttlDuration time.Duration) *TtlStringTimeMap
Click to show internal directories.
Click to hide internal directories.