time

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ISO8601 ISO8601
	ISO8601 = "2006-01-02T15:04:05.999Z"
)

Variables

View Source
var (
	ErrFormat = errors.New("error format")
)

predefined error

Functions

func Format

func Format(t int64) string

Format timestamp to time string.

func Now

func Now() string

Now current time in ISO8601 format.

func NowUnix

func NowUnix() int64

NowUnix current UTC timestamp.

func Regular

func Regular(ts string, timezone UTC) (string, error)

Regular modified to 0 time zone time.

func Revise

func Revise(ts string, timezone UTC) (string, error)

Revise correct the time to the specified time zone, only 0 time zone.

func Time added in v0.0.2

func Time() time.Time

Time time now utc

func Unix

func Unix(ts string) (int64, error)

Unix time string to timestamp.

Types

type UTC

type UTC int

UTC timezone

const (
	UTC_12 UTC = iota - 12
	UTC_11
	UTC_10
	UTC_9
	UTC_8
	UTC_7
	UTC_6
	UTC_5
	UTC_4
	UTC_3
	UTC_2
	UTC_1
	UTC0
	UTC1
	UTC2
	UTC3
	UTC4
	UTC5
	UTC6
	UTC7
	UTC8
	UTC9
	UTC10
	UTC11
	UTC12
)

UTC timezone

func Tolerant

func Tolerant(str string) (UTC, error)

Tolerant time zone analysis

func (UTC) String

func (i UTC) String() string

Jump to

Keyboard shortcuts

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