times

package
v0.0.0-...-a626ee0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFormat       = "2006-01-02 15:04:05" // 格式化时间: 年-月-日 时:分:秒(24小时制)
	DefaultFormat12     = "2006-01-02 03:04:05" // 格式化时间: 年-月-日 时:分:秒(12小时制)
	DefaultFormatDate   = "2006-01-02"
	DefaultFormatTime   = "15:04:05" // 格式化时间: 时:分:秒(24小时制)
	DefaultFormatTime12 = "03:04:05" // 格式化时间: 时:分:秒(12小时制)
)
View Source
const (
	DaySecond int64 = 3600 * 24
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Times

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

func Now

func Now(times ...interface{}) (t Times)

Now is replace time.Now()

without params returns current time with int type will parse time.Unix with string type will use defaultformat with time.Time will use time

func (Times) Add

func (t Times) Add(d time.Duration) Times

Add time.Time{}.Add

func (Times) After

func (t Times) After(n time.Time) bool

func (Times) Before

func (t Times) Before(n time.Time) bool

func (Times) Between

func (t Times) Between(start, end time.Time) bool

func (Times) Date

func (t Times) Date(i int64) Times

func (Times) DayEnd

func (t Times) DayEnd(n time.Time) Times

func (Times) DayOfYear

func (t Times) DayOfYear() int64

DayOfYear 今天在一年中的位置

func (Times) DayStart

func (t Times) DayStart(n time.Time) Times

获取当天的开始时间

func (Times) DaysOfMonth

func (t Times) DaysOfMonth(m time.Month) int

DaysOfMonth is specifies the total number of days included in the month.

指定月份包含的天数

func (Times) Diffdays

func (t Times) Diffdays(d time.Time) float64

Diffdays 两个时间相差的天数,毫秒级, 浮点型

func (Times) Difference

func (t Times) Difference(d time.Time) int64

Difference 两个时间之间的微秒差距

func (Times) Format

func (t Times) Format(formats ...string) (s string)

func (Times) Hour

func (t Times) Hour(i int64) Times

func (Times) IsToday

func (t Times) IsToday(n time.Time) bool

IsToday 是否是今天

func (Times) Minute

func (t Times) Minute(i int64) Times

func (Times) MonthDays

func (t Times) MonthDays() int

MonthDays is total number of days in the current month

当前月份包含的总天数

func (Times) Second

func (t Times) Second(i int64) Times

func (Times) SecondOfDay

func (t Times) SecondOfDay() int64

获取当前秒是一天中的多少秒

func (Times) Time

func (t Times) Time() time.Time

func (Times) UTC

func (t Times) UTC() time.Time

UTC 时间

func (Times) Unix

func (t Times) Unix() int64

Unix 时间戳,秒级

func (Times) Week

func (t Times) Week(i int64) Times

Jump to

Keyboard shortcuts

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