xtime

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: MIT Imports: 3 Imported by: 2

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 FirstSecondOfDay

func FirstSecondOfDay(offset ...int) time.Time

FirstSecondOfDay 获取一天中的第一秒

func GetFirstDayOfWeek

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

GetFirstDayOfWeek 获取一周中的第一天 offsetWeek 偏移周,例如:-1:上一周 1:下一周

func GetLastDayOfWeek

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

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

func LastSecondOfDay

func LastSecondOfDay(offset ...int) time.Time

LastSecondOfDay 获取一天中的最后一秒

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 UnixToString

func UnixToString(unix int64, format string) string

UnixToString unix时间转字符串

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