timex

package
v0.0.0-...-b62a5d4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func Since

func Since(t Time) time.Duration

Types

type Time

type Time time.Time

func Now

func Now() Time

func (Time) Add

func (t Time) Add(d time.Duration) Time

Add returns the time t+d.

func (Time) After

func (t Time) After(u Time) bool

After reports whether the time instant t is after u.

func (Time) Before

func (t Time) Before(u Time) bool

Before reports whether the time instant t is before u.

func (Time) Equal

func (t Time) Equal(u Time) bool

Equal reports whether t and u represent the same time instant. Two times can be equal even if they are in different locations. For example, 6:00 +0200 and 4:00 UTC are Equal. See the documentation on the Time type for the pitfalls of using == with Time values; most code should use Equal instead.

func (*Time) IsZero

func (t *Time) IsZero() bool

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) Scan

func (t *Time) Scan(v any) error

func (Time) String

func (t Time) String() string

func (Time) StringSource

func (t Time) StringSource() string

func (Time) Unix

func (t Time) Unix() int64

Unix 时间戳(秒)

func (Time) UnixMicro

func (t Time) UnixMicro() int64

UnixMicro 时间戳(微秒)

func (Time) UnixMilli

func (t Time) UnixMilli() int64

UnixMilli 时间戳(毫秒)

func (Time) UnixNano

func (t Time) UnixNano() int64

UnixNano 时间戳(纳秒)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

func (Time) Value

func (t Time) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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