timex

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 4 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 returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC. It is valid to pass nsec outside the range [0, 999999999]. Not all sec values have a corresponding time value. One such value is 1<<63-1 (the largest int64 value).

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 GetHour

func GetHour(t time.Time) int

GetHour gets hour number.

func GetHumanReadableDuration

func GetHumanReadableDuration(start time.Time, end time.Time) string

GetHumanReadableDuration gets a duration between times and returns format like '01:12:31' (?hour:?minute:?second).

func GetLongDateString

func GetLongDateString(t time.Time) string

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

func GetLongHumanReadableDuration

func GetLongHumanReadableDuration(start time.Time, end time.Time) string

GetLongHumanReadableDuration gets a duration between times and returns format like '1d 3h 12m 11s' (?day ?hour ?minute ?second).

func GetLongLongDateString

func GetLongLongDateString(t time.Time) string

GetLongLongDateString 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 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 GetYear

func GetYear(t time.Time) int

GetYear gets year number.

Types

This section is empty.

Jump to

Keyboard shortcuts

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