timex

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTime

func CreateTime(millis int64) time.Time

CreateTime creates a time from a millis second.

func GetCNDateString added in v1.0.7

func GetCNDateString(t time.Time) string

GetCNDateString gets short date format like '2018年11月11日'.

func GetCNDuration added in v1.0.7

func GetCNDuration(start, end time.Time) string

func GetCNWeekDay added in v1.0.7

func GetCNWeekDay(t time.Time) string

GetCNWeekDay 获取当前日期是星期几

func GetDateString

func GetDateString(t time.Time) string

GetDateString gets short date format like '2018-11-11'.

func GetDay

func GetDay(t time.Time) int

GetDay gets the day of the month.

func GetDuration added in v1.0.7

func GetDuration(start, end time.Time) string

func GetHour

func GetHour(t time.Time) int

GetHour gets hour number.

func GetLongCNDateString added in v1.0.7

func GetLongCNDateString(t time.Time) string

GetLongCNDateString gets date format like '2018年11月11日 12时12分12秒'.

func GetLongDateString

func GetLongDateString(t time.Time) string

GetLongDateString gets date format like '2018-11-11 12:12:12'.

func GetLongFullDateString added in v1.0.7

func GetLongFullDateString(t time.Time) string

GetLongFullDateString gets short date format like '2018-11-11 12:12:12,233'.

func GetMillionSecond

func GetMillionSecond(t time.Time) int

GetMillionSecond gets millionSecond number.

func GetMinute

func GetMinute(t time.Time) int

GetMinute gets minute number.

func GetMonth

func GetMonth(t time.Time) int

GetMonth gets month number.

func GetNanosecond

func GetNanosecond(t time.Time) int64

GetNanosecond gets current timestamp in Nanosecond.

func GetSecond

func GetSecond(t time.Time) int

GetSecond gets second number.

func GetShortCNDateString added in v1.0.7

func GetShortCNDateString(t time.Time) string

GetShortCNDateString gets time format like '12时12分12秒'.

func GetShortDateString

func GetShortDateString(t time.Time) string

GetShortDateString gets time format like '12:12:12'.

func GetTimestamp

func GetTimestamp(t time.Time) int64

GetTimestamp gets current timestamp in milliseconds.

func GetWeekDay added in v1.0.7

func GetWeekDay(t time.Time) string

GetWeekDay 获取当前日期是星期几

func GetYear

func GetYear(t time.Time) int

GetYear gets year number.

func ParseDate added in v1.0.7

func ParseDate(timeString string) (time.Time, error)

ParseDate 解析时间格式:

2006-01-02

func ParseTime added in v1.0.7

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

ParseTime 解析时间格式:

2006-01-02 15:04:05

func ParseTimeFromRFC3339 added in v1.0.7

func ParseTimeFromRFC3339(timeString string) (time.Time, error)

ParseTimeFromRFC3339 解析时间格式:

2006-01-02T15:04:05Z

Types

This section is empty.

Jump to

Keyboard shortcuts

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