xtime

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 4 Imported by: 9

Documentation

Index

Constants

View Source
const (
	TimeLayout     = "15:04:05"
	DateLayout     = "2006-01-02"
	DatetimeLayout = "2006-01-02 15:04:05"
	TimeFormat     = "H:i:s"
	DateFormat     = "Y-m-d"
	DatetimeFormat = "Y-m-d H:i:s"
)

Variables

This section is empty.

Functions

func GetFirstDayOfWeek

func GetFirstDayOfWeek(offsetWeeks ...int) time.Time

GetFirstDayOfWeek 获取一周中的第一天 offsetWeeks 偏移周数,例如:-1:上一周 0:本周 1:下一周

func GetFirstSecondOfDay

func GetFirstSecondOfDay(offsetDays ...int) time.Time

GetFirstSecondOfDay 获取一天中的第一秒 offsetDays 偏移天数,例如:-1:前一天 0:当前 1:明天

func GetLastDayOfWeek

func GetLastDayOfWeek(offsetWeeks ...int) time.Time

GetLastDayOfWeek 获取一周中的最后一天 offsetWeeks 偏移周数,例如:-1:上一周 0:本周 1:下一周

func GetLastSecondOfDay

func GetLastSecondOfDay(offsetDays ...int) time.Time

GetLastSecondOfDay 获取一天中的最后一秒 offsetDays 偏移天数,例如:-1:前一天 0:当前 1:明天

func Now

func Now() time.Time

Now 当前时间

func Today

func Today() time.Time

Today 今天

func Tomorrow

func Tomorrow() time.Time

Tomorrow 明天

func Transform

func Transform(t time.Time, rule ...[]TransformRule) string

Transform 时间转换

func Unix

func Unix(sec, nsec int64) time.Time

Unix 时间戳转标准时间

func UnixMicro

func UnixMicro(usec int64) time.Time

UnixMicro 时间戳(微秒)转标准时间

func UnixMilli

func UnixMilli(msec int64) time.Time

UnixMilli 时间戳(毫秒)转标准时间

func UnixNano

func UnixNano(nsec int64) time.Time

UnixNano 时间戳(纳秒)转标准时间

func Yesterday

func Yesterday() time.Time

Yesterday 昨天

Types

type TransformRule

type TransformRule struct {
	Max uint
	Tpl string
}

Jump to

Keyboard shortcuts

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