Documentation ¶
Index ¶
- Constants
- Variables
- func Date(ti int64, format string) string
- func DateParse(dateString, format string) (time.Time, error)
- func DateT(t time.Time, format string) string
- func DateToString(ts string, format string) string
- func GetBetweenDates(date_start, date_end time.Time) (d []time.Time)
- func GetCountDown(t time.Time) string
- func GetDate(src time.Time) time.Time
- func GetDateTime(date time.Time, src time.Time) (dst time.Time, _err error)
- func GetDateTimeHour(src time.Time) time.Time
- func GetFirstDateOfMonth(d time.Time) time.Time
- func GetFirstDateOfWeek(d time.Time, start_sunday bool) time.Time
- func GetFirstDateOfYear(d time.Time) time.Time
- func GetLastDateOfMonth(d time.Time) time.Time
- func GetZeroTimeOfDay(d time.Time) time.Time
- func IsToday(t time.Time) bool
- func LgToday(t time.Time) bool
- func LtToday(t time.Time) bool
- func LunarToSolar(date string, leapMonthFlag bool) (d string, err error)
- func ServerNtp(port int)
- func SolarToChineseLuanr(date string) string
- func SolarToLuanr(date string) (string, bool)
- func SolarToSimpleLuanr(date string) string
- func SyncNtp(server_ntp string)
- func TimeNtpCompare(date string) (err error)
- func TimeNullToTime(null_time TimeNull) time.Time
- func TimeStringToTime(str_time string, loc_zone *time.Location) time.Time
- func UpdateDate(src *time.Time) (_err error)
- func UpdateDateTimeHour(src *time.Time) (_err error)
- func UpdateHour(src *time.Time) (_err error)
- func UpdateSystemDate(server_ntp, dateTime string) bool
- func UpdateTime(src *time.Time) (_err error)
- type ODate
- type OTime
- type TimeNull
Constants ¶
View Source
const ( LAYOUT_DATE_TIME = "2006-01-02 15:04:05" // 日期时间格式布局 LAYOUT_DATE = "2006-01-02 00:00:00" // 日期格式布局 LAYOUT_TIME = "2000-01-01 15:04:05" // 时间格式布局 DATE_TIME_END = "2099-01-01 00:00:00" // 默认结束时间 )
View Source
const (
ODateFormat = "2006-01-02"
)
View Source
const OTimeFormat = "15:04:05"
Variables ¶
View Source
var CHINESENUMBER = []string{"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"}
View Source
var CHINESENUMBERSPECIAL = []string{"正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "腊"}
View Source
var DATELAYOUT = "2006-01-02"
View Source
var LOC_ZONE = time.FixedZone("CST", 8*3600) // 东八区
View Source
var LUNAR_INFO = []int{}/* 150 elements not displayed */
View Source
var MAX_YEAR = 2049
View Source
var MIN_YEAR = 1900
View Source
var MONTHNUMBER = map[string]int{"January": 1, "February": 2, "March": 3, "April": 4, "May": 5, "June": 6, "July": 7, "August": 8, "September": 9, "October": 10, "November": 11, "December": 12}
View Source
var NTPs = []string{
"cn.pool.ntp.org",
"cn.ntp.org.cn",
"edu.ntp.org.cn",
"ntp.aliyun.com",
"ntp1.aliyun.com",
"ntp2.aliyun.com",
"ntp3.aliyun.com",
"ntp4.aliyun.com",
"ntp5.aliyun.com",
"ntp6.aliyun.com",
"ntp7.aliyun.com",
"hk.ntp.org.cn",
"sgp.ntp.org.cn",
"us.ntp.org.cn",
"time.sunqida.cn",
}
View Source
var STARTDATESTR = "1900-01-30"
Functions ¶
func DateT ¶
Format time.Time struct to string MM - month - 01 M - month - 1, single bit DD - day - 02 D - day 2 YYYY - year - 2006 YY - year - 06 HH - 24 hours - 03 H - 24 hours - 3 hh - 12 hours - 03 h - 12 hours - 3 mm - minute - 04 m - minute - 4 ss - second - 05 s - second = 5
func DateToString ¶
Format unix time string to string
func GetDateTimeHour ¶
获取日期时整数 2023-01-02T15:00:00+08:00
func GetFirstDateOfMonth ¶
获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
func GetLastDateOfMonth ¶
获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。
func SolarToChineseLuanr ¶
func SolarToLuanr ¶
func SolarToSimpleLuanr ¶
func TimeNullToTime ¶
func UpdateDateTimeHour ¶
修改为日期整时 2023-01-02T15:00:00+08:00
func UpdateSystemDate ¶
Types ¶
type TimeNull ¶
func TimeNullNow ¶
func TimeNullNow() TimeNull
func TimeStringToTimeNull ¶
func TimeToTimeNull ¶
func UpdateTimeNull ¶
func (TimeNull) MarshalJSON ¶
func (*TimeNull) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.