times

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CHINESENUMBER = []string{"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"}
View Source
var CHINESENUMBERSPECIAL = []string{"正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "腊"}
View Source
var DATELAYOUT = "2006-01-02"
View Source
var LUNAR_INFO = []int{}/* 150 elements not displayed */
View Source
var ListNtps = []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 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 STARTDATESTR = "1900-01-30"
View Source
var ShangHaiZone, _ = time.LoadLocation("Asia/Shanghai")

Functions

func Date

func Date(ti int64, format string) string

Format unix time int64 to string

func DateParse

func DateParse(dateString, format string) (time.Time, error)

Parse Date use PHP time format.

func DateS

func DateS(ts string, format string) string

Format unix time string to string

func DateT

func DateT(t time.Time, format string) string

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 GetBetweenDates

func GetBetweenDates(date_start, date_end time.Time) (d []time.Time)

func GetFirstDateOfMonth

func GetFirstDateOfMonth(d time.Time) time.Time

获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。

func GetFirstDateOfWeek

func GetFirstDateOfWeek(d time.Time, start_sunday bool) time.Time

func GetFirstDateOfYear

func GetFirstDateOfYear(d time.Time) time.Time

获取传入的时间所在年第一天

func GetLastDateOfMonth

func GetLastDateOfMonth(d time.Time) time.Time

获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。

func GetZeroTimeOfDay

func GetZeroTimeOfDay(d time.Time) time.Time

获取某一天的0点时间

func LunarToSolar

func LunarToSolar(date string, leapMonthFlag bool) (d string, err error)

func SolarToChineseLuanr

func SolarToChineseLuanr(date string) string

func SolarToLuanr

func SolarToLuanr(date string) (string, bool)

func SolarToSimpleLuanr

func SolarToSimpleLuanr(date string) string

func TimeNtpCompare

func TimeNtpCompare(date string) (err error)

data = "2021-10-01"

Types

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL