timex

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 3 Imported by: 3

Documentation

Overview

Package timex Create on 2023/6/16 @author xuzhuoxi

Package timex Create on 2023/8/16 @author xuzhuoxi

Index

Constants

View Source
const (
	StdLongMonth             = "January"
	StdMonth                 = "Jan"
	StdNumMonth              = "1"
	StdZeroMonth             = "01"
	StdLongWeekDay           = "Monday"
	StdWeekDay               = "Mon"
	StdDay                   = "2"
	StdUnderDay              = "_2"
	StdZeroDay               = "02"
	StdHour                  = "15"
	StdHour12                = "3"
	StdZeroHour12            = "03"
	StdMinute                = "4"
	StdZeroMinute            = "04"
	StdSecond                = "5"
	StdZeroSecond            = "05"
	StdLongYear              = "2006"
	StdYear                  = "06"
	StdPM                    = "PM"
	Stdpm                    = "pm"
	StdTZ                    = "MST"
	StdISO8601TZ             = "Z0700" //prints Z for UTC
	StdISO8601SecondsTZ      = "Z070000"
	StdISO8601ShortTZ        = "Z07"
	StdISO8601ColonTZ        = "Z07:00" //prints Z for UTC
	StdISO8601ColonSecondsTZ = "Z07:00:00"
	StdNumTZ                 = "-0700" //always numeric
	StdNumSecondsTz          = "-070000"
	StdNumShortTZ            = "-07"    //always numeric
	StdNumColonTZ            = "-07:00" //always numeric
	StdNumColonSecondsTZ     = "-07:00:00"
)

Variables

View Source
var (
	ZeroUTC       = time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)
	Zero1970UTC   = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
	ZeroLocal     = time.Date(1, 1, 1, 0, 0, 0, 0, time.Local)
	Zero1970Local = time.Date(1970, 1, 1, 0, 0, 0, 0, time.Local)
)

Functions

func DurationFrom added in v1.0.4

func DurationFrom(t time.Time) time.Duration

func FormatNow

func FormatNow(layout string) string

func FormatTime

func FormatTime(time time.Time, layout string) string

func FormatUnixMilli

func FormatUnixMilli(millisecond int64, layout string) string

func FormatUnixNano

func FormatUnixNano(nanosecond int64, layout string) string

func FormatUnixSecond

func FormatUnixSecond(second int64, layout string) string

func FromMilli

func FromMilli(ms int64) time.Time

FromMilli 由毫秒时间戳生成Time

func FromNano

func FromNano(ns int64) time.Time

FromNano 由纳秒时间戳生成Time

func FromSecond

func FromSecond(sec int64) time.Time

FromSecond 由秒时间戳生成Time

func NowDuration added in v1.0.4

func NowDuration() time.Duration

func NowDuration1970 added in v1.0.4

func NowDuration1970() time.Duration

func NowFloatHours added in v1.0.4

func NowFloatHours() float64

func NowFloatHours1970 added in v1.0.4

func NowFloatHours1970() float64

func NowFloatMinutes added in v1.0.4

func NowFloatMinutes() float64

func NowFloatMinutes1970 added in v1.0.4

func NowFloatMinutes1970() float64

func NowFloatSeconds added in v1.0.4

func NowFloatSeconds() float64

func NowFloatSeconds1970 added in v1.0.4

func NowFloatSeconds1970() float64

func NowHours added in v1.0.4

func NowHours() int64

func NowHours1970 added in v1.0.4

func NowHours1970() int64

func NowMilliseconds added in v1.0.4

func NowMilliseconds() int64

func NowMilliseconds1970 added in v1.0.4

func NowMilliseconds1970() int64

func NowMinutes added in v1.0.4

func NowMinutes() int64

func NowMinutes1970 added in v1.0.4

func NowMinutes1970() int64

func NowNanos added in v1.0.4

func NowNanos() int64

func NowNanos1970 added in v1.0.4

func NowNanos1970() int64

func NowSeconds added in v1.0.4

func NowSeconds() int64

func NowSeconds1970 added in v1.0.4

func NowSeconds1970() int64

func NowTicks added in v1.0.4

func NowTicks() int64

func NowTicks1970 added in v1.0.4

func NowTicks1970() int64

func ParseDuration added in v1.0.4

func ParseDuration(durationStr string) time.Duration

func TimeFrom added in v1.0.4

func TimeFrom(d time.Duration) time.Time

Types

This section is empty.

Jump to

Keyboard shortcuts

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