v0.4.34 Latest Latest

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 5 Imported by: 0




View Source
const (
	Nanosecond  = time.Nanosecond
	Microsecond = time.Microsecond
	Millisecond = time.Millisecond
	Second      = time.Second
	Minute      = time.Minute
	Hour        = time.Hour
	Day         = 24 * time.Hour


This section is empty.


func Monotonic added in v0.4.34

func Monotonic() int64

Monotonic returns the system monotonic clock, reported in nanoseconds.

Warning: though sometimes the return value looks like a Unix nanosecond timestamp, it is not. Only use it to compute time intervals.

func NowString

func NowString() string

NowString 当前时间转换为 200601021504(年月日时分)的格式

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".

func SecondsToString

func SecondsToString(seconds int) string

func SleepSeconds added in v0.4.25

func SleepSeconds[Number number](seconds Number)

func TimeFromUnix

func TimeFromUnix(sec int64) time.Time

TimeFromUnix 使用秒级时间戳获取时间对象

func TimeFromUnixMicro

func TimeFromUnixMicro(msec uint64) time.Time

TimeFromUnixMicro 使用微秒级时间戳获取时间对象

func TimeFromUnixNano

func TimeFromUnixNano(nsec uint64) time.Time

TimeFromUnixNano 使用纳秒级时间戳获取时间对象

func TimeString

func TimeString() string

TimeString 当前时间转换为 150405(时分秒)的格式

func TimeToRelative

func TimeToRelative(d time.Time) string

func TodayString

func TodayString() string

TodayString 当前时间转换为 20060102(年月日)的格式


This section is empty.

Jump to

Keyboard shortcuts

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