Time

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANSIC         = "Mon Jan _2 15:04:05 2006"
	UnixDate      = "Mon Jan _2 15:04:05 MST 2006"
	RubyDate      = "Mon Jan 02 15:04:05 -0700 2006"
	RFC822        = "02 Jan 06 15:04 MST"
	RFC822Z       = "02 Jan 06 15:04 -0700" // RFC822 with numeric zone
	RFC850        = "Monday, 02-Jan-06 15:04:05 MST"
	RFC1123       = "Mon, 02 Jan 2006 15:04:05 MST"
	RFC1123Z      = "Mon, 02 Jan 2006 15:04:05 -0700" // RFC1123 with numeric zone
	RFC3339       = "2006-01-02T15:04:05Z07:00"
	RFC3339Nano   = "2006-01-02T15:04:05.999999999Z07:00"
	Kitchen       = "3:04PM"
	Stamp         = "Jan _2 15:04:05"
	StampMilli    = "Jan _2 15:04:05.000"
	StampMicro    = "Jan _2 15:04:05.000000"
	StampNano     = "Jan _2 15:04:05.000000000"
	UTFALL_SECOND = "2006-01-02 15:04:05"
	UTFALL_MINUTE = "2006-01-02 15:04"
	UTFALL_HOUR   = "2006-01-02 15"
	UTFALL_DATE   = "2006-01-02"
)

Variables

This section is empty.

Functions

func Get30DayExpireTime

func Get30DayExpireTime() time.Duration

* 获取30天过期时间

func Get60SecondExpireTime

func Get60SecondExpireTime() time.Duration

* 获取60秒随机过期时间

func GetArbitrarilyTimeStr

func GetArbitrarilyTimeStr(increment time.Duration) string

func GetBetweenDates

func GetBetweenDates(sdate string, edate string) []string

* GetBetweenDates 根据开始日期和结束日期计算出时间段内所有日期 参数为日期格式,如:2020-01-01

func GetFiveMinExpireTime

func GetFiveMinExpireTime() time.Duration

* 获取5分钟随机过期时间

func GetLastDayTimeStrUnderline

func GetLastDayTimeStrUnderline() string

func GetLastMonthStartAndEnd

func GetLastMonthStartAndEnd() (string, string)

* 获取上月开始日期和结束日期

func GetLastSevenDates

func GetLastSevenDates() []string

* 获取过去7天日期

func GetMonthStartAndEnd

func GetMonthStartAndEnd() (string, string)

* GetMonthStartAndEnd 获取月份的第一天和最后一天

func GetNowDayTimeStr

func GetNowDayTimeStr() string

func GetNowDayTimeStrUnderline

func GetNowDayTimeStrUnderline() string

func GetNowTime

func GetNowTime() time.Time

func GetNowTimeStr

func GetNowTimeStr() string

func GetOneDayExpireTime

func GetOneDayExpireTime() time.Duration

* 获取1天过期时间

func GetSevenExpireTime

func GetSevenExpireTime() time.Duration

* 获取七天过期时间

func GetTimeUnix

func GetTimeUnix() int64

* 生成unix十位的时间戳;单位秒

func GetTimeUnixHaoMiao

func GetTimeUnixHaoMiao() int64

* 生成UnixNano的时间戳;单位毫秒

func GetTimeUnixNano

func GetTimeUnixNano() int64

* 生成UnixNano的时间戳;单位纳秒

func GetYesterDayTimeStr

func GetYesterDayTimeStr() string

* 获取昨天的日期字符串

func OverFormatTime

func OverFormatTime(formatTime string) string

* 时间过去计算 解析字符串日期格式 :Y-m-d H:i:s

func TimePare

func TimePare(timeStr string) (time.Time, error)

Types

type TimeHelper

type TimeHelper struct {
	// contains filtered or unexported fields
}

func NewTime

func NewTime(time time.Time) *TimeHelper

func (*TimeHelper) GetDay

func (t *TimeHelper) GetDay() int

func (*TimeHelper) GetHour

func (t *TimeHelper) GetHour() int

func (*TimeHelper) GetMinute

func (t *TimeHelper) GetMinute() int

func (*TimeHelper) GetMonth

func (t *TimeHelper) GetMonth() int

func (*TimeHelper) GetSecond

func (t *TimeHelper) GetSecond() int

func (*TimeHelper) GetWeekDay

func (t *TimeHelper) GetWeekDay() *TimeWeek

func (*TimeHelper) GetYear

func (t *TimeHelper) GetYear() int

func (*TimeHelper) ToAll

func (t *TimeHelper) ToAll() string

func (*TimeHelper) ToDate

func (t *TimeHelper) ToDate() string

func (*TimeHelper) WeekByDate

func (t *TimeHelper) WeekByDate(time time.Time) *TimeWeek

type TimeWeek

type TimeWeek struct {
	Year    int
	Month   int
	Weekday int
}

Jump to

Keyboard shortcuts

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