Documentation ¶
Index ¶
- Constants
- Variables
- func AppInTimeRangeByZone(start_time, end_time int64, local_tz bool, utc_offset int32, country string, ...) bool
- func BeginTimeOfToday() int32
- func DiffDay(t1 int64, local_tz bool, utc_offset int32, country string) int32
- func DiffHour(t1 int64, local_tz bool, utc_offset int32, country string) int32
- func DiffMin(t1 int64, local_tz bool, utc_offset int32, country string) int32
- func DiffMonth(t1 int64, local_tz bool, utc_offset int32, country string) int32
- func DiffTimeRange(start_time, end_time int64, local_tz bool, utc_offset int32, country string) int64
- func DiffWeek(t1 int64, local_tz bool, utc_offset int32, country string) int32
- func DiffYear(t1 int64, local_tz bool, utc_offset int32, country string) int32
- func GetConfTimeOffset(country string) int32
- func GetData() string
- func GetDataHMS() string
- func GetDateByDiff(diff int32) string
- func GetDateByZone(diff int32) string
- func GetDayOfMonth(t1 int32) int32
- func GetDayOfWeek(t1 int32) int32
- func GetHourMinute() (int, int)
- func GetHourMinuteForTime(now int32) (int, int)
- func GetTimeByDiff(diff int64) int64
- func GetTimeByZone(diff int64) int64
- func GetTodayAssignTime(t time.Time, hour, minute int) time.Time
- func GetUtcTimeSec(time_str string) int64
- func GetYearByDiff(diff int32) string
- func GetYearMonthByDiff(diff int32) string
- func GetYearWeekByDiff(diff int32) (int, int)
- func GetZoneTimeSec(time_str string, diff int64) int64
- func HowDiffDays(t1, t2 int64) int32
- func HowDiffHour(t1, t2 int64) int32
- func HowDiffMin(t1, t2 int64) int32
- func HowDiffMonth(t1, t2 int64) int32
- func HowDiffWeek(t1, t2 int64) int32
- func HowDiffYear(t1, t2 int64) int32
- func InTimeRange(bSecond, eSecond int) bool
- func InTimeRangeByStr(start_str, end_str string, diff int64) bool
- func InTimeRangeByZone(start_time, end_time int64, local_tz bool, utc_offset int32, country string) bool
- func IsSameDay(t1, t2 int64) bool
- func IsSameDayByDayBeginHour(t1, t2 int64, dayBeginTime int) bool
- func IsSameHour(t1, t2 int64) bool
- func IsSameHourBySec(t1, t2 int64) bool
- func IsSameMinute(t1, t2 int64) bool
- func IsSameMinuteBySec(t1, t2 int64) bool
- func IsSameMonth(t1, t2 int64) bool
- func IsSameWeek(t1, t2 int64) bool
- func IsSameYear(t1, t2 int64) bool
- func LocalTimestamp(tt int64, local_tz bool, utc_offset int32, country string) int64
- func Now() int32
- func NowInt64() int64
- func NowMs() int64
- func NowNoOffset() int32
- func NowT() time.Time
- func NowUs() int64
- func ParseTimestamp(time_format string, local_tz bool, utc_offset int32, country string) int64
- func SameDay(t1 int64, local_tz bool, utc_offset int32, country string) bool
- func SameHour(t1 int64, local_tz bool, utc_offset int32, country string) bool
- func SameMonth(t1 int64, local_tz bool, utc_offset int32, country string) bool
- func SameWeek(t1 int64, local_tz bool, utc_offset int32, country string) bool
- func SameYear(t1 int64, local_tz bool, utc_offset int32, country string) bool
- func SetAutoRefresh()
- func SetTimeOffset(offset int32)
- func Tick()
- type Gtime
Constants ¶
const ( SECONDS_PER_MINUTE = 60 MINUTES_PER_HOUR = 60 HOURS_PER_DAY = 24 DAY_PER_WEEK = 7 SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY SECONDS_PER_WEEK = SECONDS_PER_DAY * DAY_PER_WEEK MS_PER_MINUTE = SECONDS_PER_MINUTE * 1000 MS_PER_HOUR = SECONDS_PER_HOUR * 1000 MS_PER_DAY = SECONDS_PER_DAY * 1000 MS_PER_SECOND = 1000 )
const
Variables ¶
var ( //地区时间偏移配置定义 ZoneTimeOffset = map[string]int32{}/* 159 elements not displayed */ )
Functions ¶
func AppInTimeRangeByZone ¶
func AppInTimeRangeByZone(start_time, end_time int64, local_tz bool, utc_offset int32, country string, app_time int64) bool
* @title: 判断指定时间是否在活动时间内,支持不同时区 * @description: 根据传入的时间,还有时区差,判断是否在活动时间内 * @param: 开始时间,结束时间,时区偏移 * @return: bool * @author Iori
func BeginTimeOfToday ¶
func BeginTimeOfToday() int32
* * @Description: 获取今日当前的秒数 * @return: int32 * @Author: Iori *
func DiffDay ¶
* * @Description: 判断当前时间差几天,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func DiffHour ¶
* * @Description: 判断当前时间差几小时,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func DiffMin ¶
* * @Description: 判断当前时间差几分,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func DiffMonth ¶
* * @Description: 判断当前时间差几月,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func DiffTimeRange ¶
func DiffTimeRange(start_time, end_time int64, local_tz bool, utc_offset int32, country string) int64
* * @Description: 对比活动时间差了多少秒 * @param: start_time * @param: end_time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: int64 * @Author: Iori *
func DiffWeek ¶
* * @Description: 判断当前时间差几周,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func DiffYear ¶
* * @Description: 判断当前时间差几年,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func GetConfTimeOffset ¶
* * @Description: 根据国家参数读取大区配置时间偏移值 * @param: country * @return: int32 * @Author: Iori *
func GetData ¶
func GetData() string
* * @Description: 获取当前日期格式 YYYY-MM-DD * @return: string * @Author: Iori *
func GetDataHMS ¶
func GetDataHMS() string
* * @Description: 获取当前日期格式 YYYY-MM-DD HH:MM:SS * @return: string * @Author: Iori *
func GetDateByDiff ¶
* @title: 获取某个时区的当前日期 * @description: YYYY-MM-DD 支持时区 * @param: diff 时区偏移 分钟 * @return: string 日期 * @author Iori
func GetDateByZone ¶
* @title: 获取某个时区的当前日期 * @description: YYYY-MM-DD 支持时区 * @param: diff 时区偏移 小时 * @return: string 日期 * @author Iori
func GetDayOfMonth ¶
* * @Description: 获取当前月的第几天 * @param: t1 * @return: int32 * @Author: Iori *
func GetDayOfWeek ¶
* * @Description: 获取当前周的第几天 * @param: t1 * @return: int32 * @Author: Iori *
func GetHourMinute ¶
* * @Description: 获取小时,分钟 * @return: int * @return: int * @Author: Iori *
func GetHourMinuteForTime ¶
* * @Description: 根据传入time 获取小时分钟 * @param: now time * @return: int * @return: int * @Author: Iori *
func GetTimeByDiff ¶
* @title: 活动对应时区的时间戳 * @description: 手动时区偏移,得到对应时区的时间戳 * @param: 时区偏移 支持分钟 * @return: int64 时间戳
func GetTimeByZone ¶
* @title: 活动对应时区的时间戳 * @description: 手动时区偏移,得到对应时区的时间戳 * @param: 时区偏移 * @return: int64 时间戳
func GetTodayAssignTime ¶
* * @Description: 获取当天XX:XX分的时间 * @param: t * @param: hour * @param: minute * @return: time.Time * @Author: Iori *
func GetUtcTimeSec ¶
* @title: 获取时间字符串的时间戳 * @description: 根据时间字符串,得到时间戳,秒单位 * @param: 时间字符串 * @return: int64 时间戳
func GetYearByDiff ¶
* @title: 获取某个时区的当前年 * @description: YYYY 支持时区 * @param: diff 时区偏移 分钟 * @return: string 日期 * @author Iori
func GetYearMonthByDiff ¶
* @title: 获取某个时区的当前年与月 * @description: YYYY-MM 支持时区 * @param: diff 时区偏移 分钟 * @return: string 日期 * @author Iori
func GetYearWeekByDiff ¶
* @title: 获取某个时区的当前第几周 * @description: YYYY-MM 支持时区 * @param: diff 时区偏移 分钟 * @return: string 日期 * @author Iori
func GetZoneTimeSec ¶
* @title: 获取字符串时间对应时区的时间戳 * @description: 根据时间字符串,得到对应时区时间戳,秒单位 * @param: 时间字符串,时区偏移 * @return: int64 时间戳
func HowDiffDays ¶
* * @Description: 计算相差的天数 * @param: t1 * @param: t2 * @return: int * @Author: Iori *
func HowDiffHour ¶
* * @Description: 差多少小时 * @param: t1 * @param: t2 * @return: int32 * @Author: Iori *
func HowDiffMin ¶
* * @Description: 差多少分钟 * @param: t1 * @param: t2 * @return: int32 * @Author: Iori *
func HowDiffMonth ¶
* * @Description: 差多少月 * @param: t1 * @param: t2 * @return: int32 * @Author: Iori *
func HowDiffWeek ¶
* * @Description: 差多少周 * @param: t1 * @param: t2 * @return: int32 * @Author: Iori *
func HowDiffYear ¶
* * @Description: 差多少年 * @param: t1 * @param: t2 * @return: int32 * @Author: Iori *
func InTimeRange ¶
* * @Description: 时间区间,一般用来判断是否活动开启时间 -- 只限当地时区 * @param: bSecond * @param: eSecond * @return: bool * @Author: Iori *
func InTimeRangeByStr ¶
* @title: 判断是否在活动时间内,支持不同时区 * @description: 根据字符串的活动时间,还有时区差,判断是否在活动时间内 * @param: 开始时间,结束时间,时区偏移 * @return: bool * @author Iori
func InTimeRangeByZone ¶
func InTimeRangeByZone(start_time, end_time int64, local_tz bool, utc_offset int32, country string) bool
* @title: 判断是否在活动时间内,支持不同时区 * @description: 根据传入的时间,还有时区差,判断是否在活动时间内 * @param: 开始时间,结束时间,时区偏移 * @return: bool * @author Iori
func IsSameDay ¶
* * @Description: 是否同一天 * @param: t1 * @param: t2 * @return: bool * @Author: Iori *
func IsSameDayByDayBeginHour ¶
* * @Description: 是否已到开始的小时时间 * @param: t1 * @param: t2 * @param: dayBeginTime * @return: bool * @Author: Iori *
func IsSameHour ¶
* * @Description: 是否同一小时 * @param: t1 * @param: t2 * @return: bool * @Author: Iori *
func IsSameHourBySec ¶
* * @Description: 是否同一小时,根据秒来计算 * @param: t1 * @param: t2 * @return: bool * @Author: Iori *
func IsSameMinute ¶
* * @Description: 是否同一分钟 * @param: t1 * @param: t2 * @return: bool *
func IsSameMinuteBySec ¶
* * @Description: 是否同一分钟,根据秒来计算 * @param: t1 * @param: t2 * @return: bool * @Author: Iori *
func IsSameMonth ¶
* * @Description: 是否同一月 * @param: t1 * @param: t2 * @return: bool * @Author: Iori *
func IsSameWeek ¶
* * @Description: 是否同一周 * @param: t1 * @param: t2 * @return: bool * @Author: Iori *
func IsSameYear ¶
* * @Description: 是否同一年 * @param: t1 * @param: t2 * @return: bool * @Author: Iori *
func LocalTimestamp ¶
* * @Description: 获取偏移时间戳 * @param: tt * @param: local_tz * @param: utc_offset 偏移分钟 * @param: country * @return: int64 时间戳 * @Author: Iori *
func Now ¶
func Now() int32
* * @Description: 获取当前时间 now,返回int32秒,支持OffSet * @return: int32 * @Author: Iori *
func NowInt64 ¶
func NowInt64() int64
* * @Description: 获取当前时间now,返回int64秒,支持OffSet * @return: int64 * @Author: Iori *
func NowMs ¶
func NowMs() int64
* * @Description: 获取当前时间now,返回int64毫秒,支持OffSet * @return: int64 * @Author: Iori *
func NowNoOffset ¶
func NowNoOffset() int32
* * @Description: 获取当前时间 now,不带OffSet * @return: int32 * @Author: Iori *
func NowUs ¶
func NowUs() int64
* * @Description: 获取当前时间now,返回int64纳秒,支持OffSet * @return: int64 * @Author: Iori *
func ParseTimestamp ¶
* * @Description: 根据字符串获取时间戳 * @param: time_format * @param: local_tz * @param: utc_offset * @return: int64 * @Author: Iori *
func SameDay ¶
* * @Description: 判断是否同一天,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func SameHour ¶
* * @Description: 判断是否同一小时,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func SameMonth ¶
* * @Description: 判断是否同一月,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func SameWeek ¶
* * @Description: 判断是否同一周,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func SameYear ¶
* * @Description: 判断是否同一年,支持时区偏移 * @param: time * @param: local_tz * @param: utc_offset 偏移分钟 * @return: bool * @Author: Iori *
func SetTimeOffset ¶
func SetTimeOffset(offset int32)
* * @Description: set Offset * @param: offset * @Author: Iori *