gtime

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeZone = "Asia/Shanghai" //默认时区设置,可以是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

format time.Now() use FormatTime

func FormatTime

func FormatTime(t time.Time) string

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

func FormatTime19

func FormatTime19(t time.Time) string

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

func FormatUTC

func FormatUTC() string

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

func GetCurrentLocalTime

func GetCurrentLocalTime() string

当前本地时间

func GetLoc

func GetLoc(zone string) *time.Location

获取时区loc

func GetTimeByTimeZone

func GetTimeByTimeZone(zone string) string

func NumberNow

func NumberNow() uint64

format time.Now() use NumberTime

func NumberTime

func NumberTime(t time.Time) uint64

format a time.Time to number as 20060102150405999

func NumberUTC

func NumberUTC() uint64

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

func ParseNumber

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

func ParseNumberUTC

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

func ParseTime

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

parse a string to time.Time

func ParseTimeUTC

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

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

func SetTimeZone

func SetTimeZone(zone string)

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