timefmt

package
v0.0.0-...-42829d4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Usage:

import "icode.baidu.com/go-lib/time/timefmt"
println(timefmt.CurrTimeGet())  // 2006-01-02 15:04:05

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.

Jump to

Keyboard shortcuts

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