timefmt

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrTimeGet

func CurrTimeGet() string

CurrTimeGet gets current time in format like 2006-01-02 15:04:05

func StrToUnix

func StrToUnix(timeStr string) (int64, error)

StrToUnix converts time string of format "2016-01-11 06:12:33" to unix timestamp

Params:

  • timeStr: time string

Returns:

(timestamp, err)

func TimestampSplit

func TimestampSplit(timestamp string) (string, string, error)

TimestampSplit splits a full time string in format "yyyyMMddHHmmss"(e.g., "20130411143020"), to "yyyyMMdd" and "HHmmss"

Params:

  • timestamp: time string in format "yyyyMMddHHmmss"

Returns:

("yyyyMMdd", "HHmmss", error)

func UnixTimeToDateTime

func UnixTimeToDateTime(unixTime int64) int64

UnixTimeToDateTime converts from unix time to date-and-time e.g., from 13923223442(int64) to 20140611120132(int64)

Params:

  • unixTime: the number of seconds elapsed since January 1, 1970 UTC.

Returns:

(datetime, error)
datetime - yyyymmddhhmmss, e.g., 20140611120132 (int64)

func UnixToStr

func UnixToStr(timestamp int64) string

UnixToStr converts unix timestamp to string of format "2006-01-02 15:04:05"

Params:

  • timestamp: unix timestamp

Returns:

time string

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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