date

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentMicros

func CurrentMicros() int64

CurrentMicros 获取当前微秒 16位

func CurrentMillis

func CurrentMillis() int64

CurrentMillis 当前毫秒 13位

func CurrentSeconds

func CurrentSeconds() int64

CurrentSeconds 当前秒级时间戳

func Now

func Now() string

Now 获取当前时间字符串,格式为:yyyy-MM-dd HH:mm:ss

func Today

func Today() string

Today 获取当前日期字符串,格式为:yyyy-MM-dd

Types

type Gtime

type Gtime time.Time

Gtime 是对time.Time类型的扩展,在序列化与反序列化时支持 yyyy-MM-dd HH:mm:ss 时间格式 golang 中 time.Time类型序列化 rfc3339 标准时间格式进行序列化的,此方式序列化出的时间字符串不方便阅读 因此Gtime重写了 MarshalJSON,UnmarshalJSON,MarshalText,UnmarshalText,String 方法来支持 yyyy-MM-dd HH:mm:ss 的格式

func (*Gtime) MarshalJSON

func (t *Gtime) MarshalJSON() ([]byte, error)

MarshalJSON time类型json序列化

func (Gtime) MarshalText

func (t Gtime) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present.

func (Gtime) String

func (t Gtime) String() string

func (*Gtime) UnmarshalJSON

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

UnmarshalJSON time类型json反序列化

func (*Gtime) UnmarshalText

func (t *Gtime) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.

Jump to

Keyboard shortcuts

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