timeutil

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnrecognizedTime = errors.New("time: unrecognized time")

ErrUnrecognizedTime is the error that parsing failed

Functions

func Now

func Now() time.Time

Now returns current time with offset

func Parse

func Parse(value string) (time.Time, error)

Parse parse string as time. If the layout of time is known, please use standard library time.Parse instead.

func ParseInLocation

func ParseInLocation(value string, loc *time.Location) (time.Time, error)

ParseInLocation is like Parse but differs in two important ways. First, in the absence of time zone information, Parse interprets a time as UTC; ParseInLocation interprets the time as in the given location. Second, when given a zone offset or abbreviation, Parse tries to match it against the Local location; ParseInLocation uses the given location.

func SetOffset

func SetOffset(off time.Duration)

SetOffset sets offset to current time

func StdNow

func StdNow() time.Time

StdNow returns standard library current time

Types

type Timestamp

type Timestamp int64

Timestamp is unix timestamp milliseconds

func GetTimestamp

func GetTimestamp(t time.Time) Timestamp

GetTimestamp returns timestamp of t

func (Timestamp) Milliseconds

func (t Timestamp) Milliseconds() int64

Milliseconds returns milliseconds of timestamp

func (Timestamp) Seconds

func (t Timestamp) Seconds() int64

Seconds returns seconds of timestamp

func (Timestamp) String

func (t Timestamp) String() string

String returns string of timestamp

func (Timestamp) Time

func (t Timestamp) Time() time.Time

Time returns time of timestamp

Jump to

Keyboard shortcuts

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