Documentation
¶
Index ¶
- func AddDateToTime(t int64, addYear int, addMonth int, addDate int, loc *time.Location) int64
- func AddSecondToNowTime(addSecs int, loc *time.Location) string
- func DateStrToTime(d string, loc *time.Location) time.Time
- func DateStrToTimeUnix(d string, loc *time.Location) int64
- func DateTimeStrToTime(dt string, loc *time.Location) time.Time
- func DateTimeStrToTimeUnix(dt string, loc *time.Location) int64
- func DateTimeStrToTimeUnixWithErr(dt string, loc *time.Location) (int64, error)
- func DayLengthFromTwoLocalDate(dateStr1 string, dateStr2 string, region string) (uint32, error)
- func GetDefaultRegion() string
- func GetNowDateStr(loc *time.Location) string
- func GetNowTimeStr(loc *time.Location) string
- func GetOffsetToUTCInSecs(region string) (int64, error)
- func GetTimeFromUnix(timestamp int64) time.Time
- func IsTheSameDay(newTimestamp int64, oldTimestamp int64, offsetSeconds int64, region string) (bool, error)
- func IsTheSameDayByHour(newTimestamp int64, oldTimestamp int64, offsetHour int64, region string) (bool, error)
- func IsTheSameWeek(newTimestamp, oldTimestamp, offsetSeconds int64, region string) (bool, error)
- func IsTheSameWeekByHour(newTimestamp, oldTimestamp, offsetHour int64, region string) (bool, error)
- func IsWeekend(t time.Time) bool
- func LastRegionWeekRefreshTime(t time.Time, refreshDay time.Weekday, refreshHour int, refreshMinutes int, ...) time.Time
- func LastXHourTime(addHour time.Duration, loc *time.Location) time.Time
- func LastXHourTimeUnix(addHour time.Duration, loc *time.Location) int64
- func LocalDate(datetime string, region string) (string, error)
- func LocalDateByAddSomeDays(dateStr string, someDays int64, region string) (string, error)
- func LocalDateFromTimestamp(timestamp int64, region string) (string, error)
- func LocalDateTime(datetime string, region string) (string, error)
- func LocalDateTimeFromTimestamp(timestamp int64, region string) (string, error)
- func LocalDateTimeToLocalDate(datetimeStr string, offsetHour int64, region string) (string, error)
- func LocalDateTimeToTimeStamp(datetime string, region string) (int64, error)
- func LocalDateToTimeStamp(datetime string, region string) (int64, error)
- func LocalIsNeedResetDailyAtXHourChkByNow(resetHour, nowTimestamp, lastUpdateTimestamp int64, region string) (bool, error)
- func LocalIsNeedResetMonthlyAtXHourChkByNow(resetHour, nowTimestamp, lastUpdateTimestamp int64, region string) (bool, error)
- func LocalIsNeedResetWeeklyAtXHourChkByNow(resetHour, nowTimestamp, lastUpdateTimestamp int64, region string) (bool, error)
- func LocalIsNeedRestDailyAtXHour(resetHour int64, lastUpdateTimestamp int64, region string) (bool, error)
- func LocalIsNeedRestMonthlyAtXHour(resetHour int64, lastUpdateTimestamp int64, region string) (bool, error)
- func LocalIsNeedRestWeeklyAtXHour(resetHour int64, lastUpdateTimestamp int64, region string) (bool, error)
- func LocalMondayFromTimeStamp(timestamp int64, region string) (string, error)
- func LocalMonthFromTimestamp(timestamp int64, region string) (string, error)
- func LocalNowDate(region string) (string, error)
- func LocalNowDateTime(region string) (string, error)
- func LocalTodayXHourTimeUnix(addHour time.Duration, region string) int64
- func LocalTomorrowXHourTimeUnix(addHour time.Duration, region string) int64
- func LocalWeekday(region string) (int32, error)
- func LocalWeekdayFromTimestamp(timestamp int64, region string) (int32, error)
- func LocalYesterdayXHourTimeUnix(addHour time.Duration, region string) int64
- func PatchDefaultRegion(region string) error
- func PatchRegionLocationMapping(options ...*PatchOption)
- func RegionMonday4HourDateTime(loc *time.Location) string
- func RegionMondayXHourTimestamp(region string, addHour uint32) (int64, error)
- func RegionNextDailyResetHourTimeUnix(resetHour int64, region string) (int64, error)
- func RegionNextDailyResetHourTimeUnixFrom(timestamp int64, resetHour int64, region string) (int64, error)
- func RegionPassedDayFromDateTime(region string, datetime string) (uint32, error)
- func RegionTimeZoneLocation(region string) (*time.Location, error)
- func ThisMondayXHourTimeUnix(addHour time.Duration, loc *time.Location) int64
- func TimeToDate(t time.Time) string
- func TimeToDateTime(t time.Time) string
- func TodayXHourTime(addHour time.Duration, loc *time.Location) time.Time
- func TodayXHourTimeUnix(addHour time.Duration, loc *time.Location) int64
- func TomorrowXHourTime(addHour time.Duration, loc *time.Location) time.Time
- func TomorrowXHourTimeUnix(addHour time.Duration, loc *time.Location) int64
- type PatchOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDateToTime ¶
AddDateToTime add year,month and date, if loc is nil, using local time zone
func AddSecondToNowTime ¶
AddSecondToNowTime add seconds to now time, if loc is nil, using local time zone
func DateStrToTime ¶
DateStrToTime string format "2006-01-02"
func DateStrToTimeUnix ¶
DateStrToTimeUnix string format "2006-01-02" to timestamp
func DateTimeStrToTime ¶
DateTimeStrToTime string format "2006-01-02 15:04:05"
func DateTimeStrToTimeUnix ¶
DateTimeStrToTimeUnix string format "2006-01-02 15:04:05" to timestamp
func DateTimeStrToTimeUnixWithErr ¶
DateTimeStrToTimeUnix string format "2006-01-02 15:04:05" to timestamp
func DayLengthFromTwoLocalDate ¶
DayLengthFromTwoLocalDate :
func GetDefaultRegion ¶
func GetDefaultRegion() string
func GetNowDateStr ¶
GetNowDateStr string format "2006-01-02" if loc is nil, using local time zone
func GetNowTimeStr ¶
GetNowTimeStr string format "2006-01-02 15:04:05" if loc is nil, using local time zone
func GetOffsetToUTCInSecs ¶
GetOffsetToUTCInSecs : calculate the offset in seconds between the input region and UTC
func IsTheSameDay ¶
func IsTheSameDay(newTimestamp int64, oldTimestamp int64, offsetSeconds int64, region string) (bool, error)
IsTheSameDay check two timestamp whether is the same day
func IsTheSameDayByHour ¶
func IsTheSameDayByHour(newTimestamp int64, oldTimestamp int64, offsetHour int64, region string) (bool, error)
IsTheSameDayByHour use offsetHour as the dividing time point, check two timestamp whether is the same day
func IsTheSameWeek ¶
IsTheSameWeek check two timestamp whether is the same week
func IsTheSameWeekByHour ¶
IsTheSameWeekByHour use offsetHour as the dividing time point, check two timestamp whether is the same week
func LastRegionWeekRefreshTime ¶
func LastRegionWeekRefreshTime(t time.Time, refreshDay time.Weekday, refreshHour int, refreshMinutes int, loc *time.Location) time.Time
LastRegionWeekRefreshTime return the last refresh time for the event's refresh weekly based on region For exmaple, if the refresh time is Monday 08:00 in each region and check region is -0500 EST If t is 2018-04-02 12:59 0000 UTC which is 2018-04-02 07:59 -0500 EST would return 2018-03-26 08:00 -0500 EST If t is 2018-04-02 13:01 0000 UTC which is 2018-04-02 08:01 -0500 EST would return 2018-04-02 08:00 -0500 EST
func LastXHourTime ¶
LastXHourTime if loc is nil, using local time zone
func LastXHourTimeUnix ¶
LastXHourTimeUnix if loc is nil, using local time zone
func LocalDateByAddSomeDays ¶
LocalDateByAddSomeDays : 2016-01-02 + (2days-1) = 2016-01-03
func LocalDateFromTimestamp ¶
LocalDateFromTimestamp : convert timestamp to Local datetime, format yyyy-mm-dd
func LocalDateTime ¶
LocalDateTime : convert GMT+8 datetime to Local datetime, format yyyy-mm-dd hh:ii:ss
func LocalDateTimeFromTimestamp ¶
LocalDateTimeFromTimestamp : convert timestamp to Local datetime, format yyyy-mm-dd hh:ii:ss
func LocalDateTimeToLocalDate ¶
LocalDateTimeToLocalDate : convert datetime to date, from yyyy-mm-dd hh:ii:ss to yyyy-mm-dd
func LocalDateTimeToTimeStamp ¶
LocalDateTimeToTimeStamp : convert datetime to timestamp, format yyyy-mm-dd hh:ii:ss
func LocalDateToTimeStamp ¶
LocalDateToTimeStamp : convert datetime to timestamp, format yyyy-mm-dd
func LocalIsNeedResetDailyAtXHourChkByNow ¶
func LocalIsNeedResetDailyAtXHourChkByNow(resetHour, nowTimestamp, lastUpdateTimestamp int64, region string) (bool, error)
LocalIsNeedResetDailyAtXHourChkByNow : reset daily at xx hour Caution : return true if last update time is 0
func LocalIsNeedResetMonthlyAtXHourChkByNow ¶
func LocalIsNeedResetMonthlyAtXHourChkByNow(resetHour, nowTimestamp, lastUpdateTimestamp int64, region string) (bool, error)
LocalIsNeedResetMonthlyAtXHourChkByNow : reset monthly at xx hour Caution : return true if last update time is 0
func LocalIsNeedResetWeeklyAtXHourChkByNow ¶
func LocalIsNeedResetWeeklyAtXHourChkByNow(resetHour, nowTimestamp, lastUpdateTimestamp int64, region string) (bool, error)
LocalIsNeedResetWeeklyAtXHourChkByNow : reset monthly at xx hour Caution : return true if last update time is 0
func LocalIsNeedRestDailyAtXHour ¶
func LocalIsNeedRestDailyAtXHour(resetHour int64, lastUpdateTimestamp int64, region string) (bool, error)
LocalIsNeedRestDailyAtXHour : reset daily at xx hour Caution : return true if last update time is 0
func LocalIsNeedRestMonthlyAtXHour ¶
func LocalIsNeedRestMonthlyAtXHour(resetHour int64, lastUpdateTimestamp int64, region string) (bool, error)
LocalIsNeedRestMonthlyAtXHour : reset monthly at xx hour Caution : return true if last update time is 0
func LocalIsNeedRestWeeklyAtXHour ¶
func LocalIsNeedRestWeeklyAtXHour(resetHour int64, lastUpdateTimestamp int64, region string) (bool, error)
LocalIsNeedRestWeeklyAtXHour : reset monthly at xx hour Caution : return true if last update time is 0
func LocalMondayFromTimeStamp ¶
LocalMondayFromTimeStamp return region Monday date, format: 2006-01-02
func LocalMonthFromTimestamp ¶
LocalMonthFromTimestamp : convert timestamp to Local datetime, format yyyy-mm
func LocalNowDate ¶
LocalNowDate : get local datetime now, format yyyy-mm-dd
func LocalNowDateTime ¶
LocalNowDateTime : get local datetime now, format yyyy-mm-dd hh:ii:ss
func LocalTodayXHourTimeUnix ¶
LocalTodayXHourTimeUnix using regional timezone
func LocalTomorrowXHourTimeUnix ¶
LocalTomorrowXHourTimeUnix using regional timezone
func LocalWeekday ¶
LocalWeekday : get local weekday. Monday = 1, Sunday = 7
func LocalWeekdayFromTimestamp ¶
LocalWeekdayFromTimestamp : get local weekday by timestamp. Monday = 1, Sunday = 7
func LocalYesterdayXHourTimeUnix ¶
LocalYesterdayXHourTimeUnix using regional timezone
func PatchDefaultRegion ¶
PatchDefaultRegion change the default region for the pkg
func PatchRegionLocationMapping ¶
func PatchRegionLocationMapping(options ...*PatchOption)
PatchRegionLocationMapping change the default region location mapping for the pkg
func RegionMonday4HourDateTime ¶
RegionMonday5HourDateTime return region Monday 05am date, format: 2006-01-02 04:00:00
func RegionMondayXHourTimestamp ¶
RegionMondayXHourTimestamp return region Monday 0x:00:00 timestamp
func RegionNextDailyResetHourTimeUnix ¶
RegionNextDailyResetHourTimeUnix return next reset time unix using regional timezone
func RegionNextDailyResetHourTimeUnixFrom ¶
func RegionNextDailyResetHourTimeUnixFrom(timestamp int64, resetHour int64, region string) (int64, error)
RegionNextDailyResetHourTimeUnixFrom : return next resetHour timestamp from given time
func RegionPassedDayFromDateTime ¶
RegionPassedDayFromDateTime return passed day from datetime to nowtime
func RegionTimeZoneLocation ¶
RegionTimeZoneLocation : return time zone location
func ThisMondayXHourTimeUnix ¶
ThisMondayXHourTimeUnix if loc is nil, using local time zone
func TimeToDateTime ¶
TimeToDateTime format "2006-01-02 15:04:05"
func TodayXHourTime ¶
TodayXHourTime if loc is nil, using local time zone
func TodayXHourTimeUnix ¶
TodayXHourTimeUnix if loc is nil, using local time zone
func TomorrowXHourTime ¶
TomorrowXHourTime if loc is nil, using local time zone