time

package
v0.0.0-...-1ec2636 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

***

高性能时间,精确到0.1秒

***

Index

Constants

View Source
const (
	TIME_LAYOUT_1 = "2006-01-02 15:04:05"
	TIME_LAYOUT_2 = "2006-01-02"
	TIME_LAYOUT_3 = "2006-01-02T15:04:05Z"
	TIME_LAYOUT_4 = "2006年01月02日"
	TIME_LAYOUT_5 = "2006年01月"
	TIME_LAYOUT_6 = "2006年01月02日 15:04"
	TIME_LAYOUT_7 = "20060102"
	TIME_LAYOUT_8 = "01月02日"
	TIME_LAYOUT_9 = "Mon, 02 Jan 2006 15:04:05 MST"
)

Variables

Functions

func After

func After(diff int) int64

当前时间多少秒后

func DurationTo

func DurationTo(days int, H, M, S int) time.Duration

从现在到[days]天后的[H:M:S]时刻的时长

func FormatDay2Year

func FormatDay2Year(days int) string

func FormatPrevLogin

func FormatPrevLogin(tm time.Time) (st string)

func FormatRunTime

func FormatRunTime(tm time.Time) (st string)

转换时间到当前时间是多少天多少小时

func FormatSec2Hour

func FormatSec2Hour(tm int64) string

func FormatSec2HourInt

func FormatSec2HourInt(tm int64) string

func GetTimeStamp

func GetTimeStamp() int64

获取当前时间戳,单位秒

func GetTimeStampFromStr

func GetTimeStampFromStr(time_str string) (tms int64, e error)

获取当前时间戳,单位秒

func GetWeekdayCN

func GetWeekdayCN(t time.Time) (w string)

func PrintDuration

func PrintDuration(key string, start time.Time, exceed time.Duration)

打印超过exceed时长的时间 Prams:

key: 用于识别的关键字
start: 起始时间
exceed: 持续时间超过多久才打印

func TmLime

func TmLime(tmflag string) (stm, etm string)

获取时间界限,如:today 返回stm: 2015-05-01 00:00:00 etm: 2015-05-02: 00:00:00

func ToTime

func ToTime(v interface{}, layout ...string) (t time.Time, e error)

可以把字符串、时间、数字(当成秒)转换成时间类型

Types

This section is empty.

Jump to

Keyboard shortcuts

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