times

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatDateTime = "2006-01-02 15:04:05"
	FormatDate     = "2006-01-02"
	FormatDateTS17 = "20060102150405000"
	FormatDateTS14 = "20060102150405"
	FormatDateTS8  = "20060102"
	FormatDateTS6  = "200601"
)

Variables

View Source
var LOC, _ = time.LoadLocation("Asia/Shanghai")

Functions

func AddDatesToDate

func AddDatesToDate(days int) string

AddDatesToDate time.Now() 通过增加days返回days天后的日期 2006-01-02 格式,days可以是负数

func AddDatesToDateTime

func AddDatesToDateTime(days int) string

AddDatesToDateTime time.Now() 通过增加days返回days天后的日期与时间 2006-01-02 15:04:05 格式,days可以是负数

func AddDatesToTime10

func AddDatesToTime10(days int) int64

AddDatesToTime10 time.Now() 通过增加days返回days天后的10位时间戳,days可以是负数

func AddDatesToTime13

func AddDatesToTime13(days int) int64

AddDatesToTime13 time.Now() 通过增加days返回days天后的13位时间戳,days可以是负数

func AddDaysToZeroTime10

func AddDaysToZeroTime10(days int) int64

AddDaysToZeroTime10 time.Now() 通过增加days返回days天后 00:00:00 时的10位时间戳,days可以是负数

func CurrentDate

func CurrentDate() string

CurrentDate time.Now() 获取当前日期 2006-01-02 格式

func CurrentDateTime

func CurrentDateTime() string

CurrentDateTime time.Now() 获取当前日期与时间 2006-01-02 15:04:05 格式

func Date19ToTime13

func Date19ToTime13(t string) int64

Date19ToTime13 日期19位转13位时间戳,例如 2016-11-14 14:31:16 转13位时间戳

func DateTs14ToTime13

func DateTs14ToTime13(t string) int64

DateTs14ToTime13 日期Ts14位转13位时间戳,例如 20161114143116 转13位时间戳

func DateTs17ToTime13

func DateTs17ToTime13(t string) int64

DateTs17ToTime13 日期Ts17位转13位时间戳,例如 20161114143116001 转13位时间戳

func Millisecond

func Millisecond() int64

Millisecond time.Now() 生成13位时间戳(毫秒)

func RFC3339ToDateTime

func RFC3339ToDateTime(t string) (string, error)

RFC3339ToDateTime RFC3339格式数据 2006-01-02T15:04:05Z 转日期与时间 2006-01-02 15:04:05 格式

func Second

func Second() int64

Second time.Now() 生成10位时间戳(秒)

func Tim13ToYearMonthSlice

func Tim13ToYearMonthSlice(startTime int64, endTime int64) []int

Tim13ToYearMonthSlice 输入开始和结束的13位时间戳,输出其包含的年份和月份数组,例如 [202209, 202210]

func Time10ToDate

func Time10ToDate(t int64) string

Time10ToDate 10位时间戳转日期与时间 2006-01-02 15:04:05 格式

func Time10ToTime

func Time10ToTime(t int64) time.Time

Time10ToTime 10位时间戳转Time

func Time13ToDate

func Time13ToDate(t int64) string

Time13ToDate 13位时间戳转日期 2006-01-02 格式

func Time13ToDateTime

func Time13ToDateTime(t int64) string

Time13ToDateTime 13位时间戳转日期和时间 2006-01-02 15:04:05 格式

func Time13ToDateTs14

func Time13ToDateTs14(t int64) string

Time13ToDateTs14 13位时间戳转日期Ts14位,例如 20161114143116 格式

func Time13ToDateTs17

func Time13ToDateTs17(t int64) string

Time13ToDateTs17 13位时间戳转日期Ts17位,例如 20161114143116001 格式

func Time13ToTS8

func Time13ToTS8(t int64) string

Time13ToTS8 13位时间戳转日期Ts8位,例如 20161114 格式

func Time13ToTime

func Time13ToTime(t int64) time.Time

Time13ToTime 13位时间戳转Time

func TimeToTime13

func TimeToTime13(t time.Time) int64

TimeToTime13 Time转13位时间戳

func TimeZoneParse

func TimeZoneParse(seconds int64) string

TimeZoneParse TimeZoneParse, 返回 1970-01-01 08:00:00 后加 seconds 秒之后的日期与时间 2006-01-02 15:04:05 格式

Types

This section is empty.

Jump to

Keyboard shortcuts

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