timeutils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

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

CSTLayout China Standard Time Layout

Variables

This section is empty.

Functions

func CSTLayoutString

func CSTLayoutString() string

CSTLayoutString returns time string in "2006-01-02 15:04:05" format

func CSTLayoutStringToUnix

func CSTLayoutStringToUnix(cstLayoutString string) (int64, error)

CSTLayoutStringToUnix return unix timestamp 2020-01-24 21:11:11 => 1579871471

func GMTLayoutString

func GMTLayoutString() string

GMTLayoutString returns time sting in "Mon, 02 Jan 2006 15:04:05 GMT" format

func ParseCSTInLocation

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

ParseCSTInLocation formats time use China Standard Time Layout

func ParseGMTInLocation

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

ParseGMTInLocation formats time use GMT layout

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 calculates time difference

Types

type Time

type Time time.Time

func (*Time) MarshalJSON

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

MarshalJSON marshals time json in "2006-01-02 15:04:05" format

Jump to

Keyboard shortcuts

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