timex

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

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

CSTLayout China Standard JSONTime Layout

Variables

This section is empty.

Functions

func CSTLayoutString

func CSTLayoutString() string

CSTLayoutString 格式化时间 返回 "2006-01-02 15:04:05" 格式的时间

func CSTLayoutStringToUnix

func CSTLayoutStringToUnix(cstLayoutString string) (int64, error)

CSTLayoutStringToUnix 返回 unix 时间戳 2020-01-24 21:11:11 => 1579871471

func ConvertTime

func ConvertTime(t JSONTime) time.Time

func GMTLayoutString

func GMTLayoutString() string

GMTLayoutString 格式化时间 返回 "Mon, 02 Jan 2006 15:04:05 GMT" 格式的时间

func MinuteToNano

func MinuteToNano(minute int64) (nano int64)

MinuteToNano 分钟转纳秒

func NanoToMilli

func NanoToMilli(nano int64) (milli int64)

NanoToMilli 纳秒转毫秒

func ParseCSTInLocation

func ParseCSTInLocation(date string) (time.Time, error)

ParseCSTInLocation 格式化时间

func ParseGMTInLocation

func ParseGMTInLocation(date string) (time.Time, error)

ParseGMTInLocation 格式化时间

func RFC3339ToCSTLayout

func RFC3339ToCSTLayout(value string) (string, error)

RFC3339ToCSTLayout convert rfc3339 value to china standard time layout 2020-11-08T08:18:46+08:00 => 2020-11-08 08:18:46

func SubInLocation

func SubInLocation(ts time.Time) float64

SubInLocation 计算时间差

Types

type JSONTime

type JSONTime time.Time

func ConvertJSONTime

func ConvertJSONTime(t time.Time) JSONTime

ConvertJSONTime 类型转换

func JSONTimeNow

func JSONTimeNow() JSONTime

JSONTimeNow 获得一个当前时间

func (JSONTime) MarshalJSON

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

func (*JSONTime) Scan

func (t *JSONTime) Scan(value interface{}) error

func (JSONTime) String

func (t JSONTime) String() string

func (*JSONTime) UnmarshalJSON

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

func (JSONTime) Value

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

Jump to

Keyboard shortcuts

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