gtime

package
v1.0.103 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MulanPSL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STANDARD_FORMAT = "2006-01-02 15:04:05"
	DATE_FORMAT     = "2006-01-02"
	MONTH_FORMAT    = "2006-01"
	FLAT_DATE       = "20060102"
	FLAT_FORMAT     = "20060102150405"
)

常量:时间格式

Variables

This section is empty.

Functions

func AddDuration

func AddDuration(t time.Time, duration string) (time.Time, error)

AddDuration 给指定时间增加指定的时间间隔

func FormatTimestamp

func FormatTimestamp(ts int64, layout string) string

FormatTimestamp 格式化时间戳为指定格式

func GetCurrentMilliTimestamp

func GetCurrentMilliTimestamp() int64

GetCurrentMilliTimestamp 获取当前时间戳(毫秒级)

func GetCurrentTime

func GetCurrentTime() string

GetCurrentTime 获取当前时间的标准格式字符串

func GetCurrentTimestamp

func GetCurrentTimestamp() int64

GetCurrentTimestamp 获取当前时间戳(秒级)

func ParseTime

func ParseTime(value string) (time.Time, error)

ParseTime 按标准格式解析时间字符串

func ParseTimeWithFormat

func ParseTimeWithFormat(value, layout string) (time.Time, error)

ParseTimeWithFormat 按指定格式解析时间字符串

func StandardFormat

func StandardFormat(ts int64) string

StandardFormat 格式化时间戳为标准时间字符串

func SubtractTimes

func SubtractTimes(t1, t2 time.Time) time.Duration

SubtractTimes 计算两个时间的差值

Types

This section is empty.

Jump to

Keyboard shortcuts

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