timeutil

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// OneSecond is the number of millisecond for a second
	OneSecond int64 = 1000
	// OneMinute is the number of millisecond for a minute
	OneMinute = 60 * OneSecond
	// OneHour is the number of millisecond for an hour
	OneHour = 60 * OneMinute
	// OneDay is the number of millisecond for a day
	OneDay = 24 * OneHour
	// OneWeek is the number of millisecond for a week
	OneWeek = 7 * OneDay
	// OneMonth is the number of millisecond for a month
	OneMonth = 30 * OneDay
	// OneYear is the number of millisecond for a year
	OneYear = 365 * OneDay

	DataTimeFormat1 = "20060102 15:04:05"
	DataTimeFormat2 = "2006-01-02 15:04:05"
	DataTimeFormat3 = "2006/01/02 15:04:05"
	DataTimeFormat4 = "20060102150405"
)

Variables

This section is empty.

Functions

func FormatTimestamp

func FormatTimestamp(timestamp int64, layout string) string

FormatTimestamp returns timestamp format based on layout

func Now

func Now() int64

Now returns t as a Unix time, the number of millisecond elapsed since January 1, 1970 UTC. The result does not depend on the location associated with t.

func NowNano

func NowNano() int64

NowNano returns t as a unix time, the number of nanoseconds elapsed

func ParseTimestamp

func ParseTimestamp(timestampStr string, layout ...string) (int64, error)

ParseTimestamp parses timestamp str value based on layout using local zone

Types

This section is empty.

Jump to

Keyboard shortcuts

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