gtime

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeZone = "Asia/Shanghai"

TimeZone 默认时区设置,可以是Local本地时区

Functions

func Date

func Date(format string, timestamp int64) string

Date date() Date("02/01/2006 15:04:05 PM", 1524799394)

func FormatNow

func FormatNow() string

FormatNow format time.Now() use FormatTime

func FormatTime

func FormatTime(t time.Time) string

FormatTime format a time.Time to string as 2006-01-02 15:04:05.999

func FormatTime19

func FormatTime19(t time.Time) string

FormatTime19 format a time.Time to string as 2006-01-02 15:04:05 将time.time转换为日期格式

func FormatUTC

func FormatUTC() string

FormatUTC format time.Now().UTC() use FormatTime

func GetCurrentLocalTime

func GetCurrentLocalTime() string

GetCurrentLocalTime 当前本地时间

func GetLoc

func GetLoc(zone string) *time.Location

GetLoc 获取时区loc

func GetTimeByTimeZone

func GetTimeByTimeZone(zone string) string

GetTimeByTimeZone get time by zone.

func NumberNow

func NumberNow() uint64

NumberNow format time.Now() use NumberTime

func NumberTime

func NumberTime(t time.Time) uint64

NumberTime format a time.Time to number as 20060102150405999

func NumberUTC

func NumberUTC() uint64

NumberUTC format time.Now().UTC() use NumberTime

func ParseNumber

func ParseNumber(t uint64) (time.Time, error)

ParseNumber parse t to time.Time

func ParseNumberUTC

func ParseNumberUTC(t uint64) (time.Time, error)

ParseNumberUTC parset t to utc time

func ParseTime

func ParseTime(s string) (time.Time, error)

ParseTime parse a string to time.Time

func ParseTimeUTC

func ParseTimeUTC(s string) (time.Time, error)

ParseTimeUTC parse a string as "2006-01-02 15:04:05.999" to time.Time

func SetTimeZone

func SetTimeZone(zone string)

SetTimeZone set time zone.

func Sleep

func Sleep(t int64)

Sleep sleep()

func StrToTime

func StrToTime(format, strTime string) (int64, error)

StrToTime strtotime() StrToTime("02/01/2006 15:04:05", "02/01/2016 15:04:05") == 1451747045 StrToTime("3 04 PM", "8 41 PM") == -62167144740

func Time

func Time() int64

Time time()

func Usleep

func Usleep(t int64)

Usleep usleep()

Types

This section is empty.

Jump to

Keyboard shortcuts

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