time

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatDateTime = "2006-01-02 15:04:05"
	FormatDate     = "2006-01-02"
	FormatTime     = "15:04:05"

	TimeZoneSH = "Asia/Shanghai"
)

Variables

View Source
var (
	TimeZero = Time(time.Time{})
	TimeNow  = Time(time.Now())
)

Functions

func IntToString

func IntToString(t int) string

IntToString 将int转换为时间字符串 例如: 1560000000 -> 2019-06-09 00:00:00

func IntToStringDate

func IntToStringDate(t int) string

IntToStringDate 将int转换为日期字符串 例如: 1560000000 -> 2019-06-09

func IntToStringTime

func IntToStringTime(t int) string

IntToStringTime 将int转换为时间字符串 例如: 1560000000 -> 00:00:00

func NowTimeStamp added in v0.2.3

func NowTimeStamp() int

NowTimeStamp 例如: 1560000000

func NowTimeStr added in v0.2.3

func NowTimeStr() string

NowTimeStr 获取当前时间字符串 例如: 2019-06-09 00:00:00

func StringToInt

func StringToInt(t string) int

StringToInt 将时间字符串转换为int 例如: 2019-06-09 00:00:00 -> 1560000000

Types

type JsonTime

type JsonTime time.Time

func (JsonTime) MarshalJSON

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

type Time added in v0.1.6

type Time time.Time // 和JsonTime一样,只是为了方便使用

func (Time) MarshalJSON added in v0.1.6

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

Jump to

Keyboard shortcuts

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