gotime

package
v1.0.30 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC822Format  = "Mon, 02 Jan 2006 15:04:05 MST"
	ISO8601Format = "2006-01-02T15:04:05Z"
)

Variables

This section is empty.

Functions

func FormatISO8601Date

func FormatISO8601Date(timestampSecond int64) string

func GetCurrentDate

func GetCurrentDate() string

GetCurrentDate 获取当前的时间 - 字符串

func GetCurrentMilliUnix

func GetCurrentMilliUnix() int64

GetCurrentMilliUnix 获取当前的时间 - 毫秒级时间戳

func GetCurrentNanoUnix

func GetCurrentNanoUnix() int64

GetCurrentNanoUnix 获取当前的时间 - 纳秒级时间戳

func GetCurrentUnix

func GetCurrentUnix() int64

GetCurrentUnix 获取当前的时间 - Unix时间戳

func GetCurrentWjDate

func GetCurrentWjDate() string

GetCurrentWjDate 获取当前的时间 - 字符串 - 没有间隔

func NowUTCNanoSeconds

func NowUTCNanoSeconds() int64

func NowUTCSeconds

func NowUTCSeconds() int64

Types

type Pro

type Pro struct {
	Time time.Time
}

Pro 结构体

func Current

func Current() Pro

Current 获取当前的时间

func NewPro

func NewPro() Pro

NewPro 初始化结构体

func SetCurrent

func SetCurrent(sTime time.Time) Pro

SetCurrent 设置当前的时间

func SetCurrentParse

func SetCurrentParse(str string) Pro

SetCurrentParse 设置当前的时间

func SetCurrentUnix added in v1.0.30

func SetCurrentUnix(ts int64) Pro

SetCurrentUnix 设置当前的时间 Unix时间戳

func (Pro) AfterDay

func (p Pro) AfterDay(day int) Pro

AfterDay 获取n天后的时间

func (Pro) AfterHour

func (p Pro) AfterHour(hour int) Pro

AfterHour 获取n小时后的时间

func (Pro) AfterSeconds

func (p Pro) AfterSeconds(seconds int) Pro

AfterSeconds 获取n秒后的时间

func (Pro) BeforeDay

func (p Pro) BeforeDay(day int) Pro

BeforeDay 获取n天前的时间

func (Pro) BeforeHour

func (p Pro) BeforeHour(hour int) Pro

BeforeHour 获取n小时前的时间

func (Pro) BeforeSeconds

func (p Pro) BeforeSeconds(seconds int) Pro

BeforeSeconds 获取n秒前的时间

func (Pro) DiffInHour

func (p Pro) DiffInHour(t2 time.Time) (hour int64)

DiffInHour 相差多少小时

func (Pro) DiffInHourWithAbs

func (p Pro) DiffInHourWithAbs(t2 time.Time) (hour int64)

DiffInHourWithAbs 相差多少小时(绝对值)

func (Pro) DiffInMinutes

func (p Pro) DiffInMinutes(t2 time.Time) (hour int64)

DiffInMinutes 相差多少分钟

func (Pro) DiffInMinutesWithAbs

func (p Pro) DiffInMinutesWithAbs(t2 time.Time) (hour int64)

DiffInMinutesWithAbs 相差多少分钟(绝对值)

func (Pro) DiffInSecond

func (p Pro) DiffInSecond(t2 time.Time) (hour int64)

DiffInSecond 相差多少秒

func (Pro) DiffInSecondWithAbs

func (p Pro) DiffInSecondWithAbs(t2 time.Time) (hour int64)

DiffInSecondWithAbs 相差多少秒(绝对值)

func (Pro) EndOfDay

func (p Pro) EndOfDay() Pro

EndOfDay 本日结束时间

func (Pro) Format

func (p Pro) Format() string

Format 格式化

func (Pro) Nanosecond

func (p Pro) Nanosecond() int

Nanosecond 时间戳小数部分 单位:纳秒

func (Pro) Now

func (p Pro) Now() time.Time

Now 返回当前时间

func (Pro) SetFormat

func (p Pro) SetFormat(layout string) string

SetFormat 格式化

func (Pro) StartOfDay

func (p Pro) StartOfDay() Pro

StartOfDay 本日开始时间

func (Pro) Timestamp

func (p Pro) Timestamp() int64

Timestamp 秒级时间戳

func (Pro) TimestampWithMillisecond

func (p Pro) TimestampWithMillisecond() int64

TimestampWithMillisecond 毫秒级时间戳

func (Pro) Unix

func (p Pro) Unix() int64

Unix 时间戳

func (Pro) UnixNano

func (p Pro) UnixNano() int64

UnixNano 纳秒级时间戳

Jump to

Keyboard shortcuts

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