datetime

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const LayoutDate = "2006-01-02"
View Source
const LayoutDateTime = "2006-01-02 15:04:05"
View Source
const LayoutDateTimeZone = "2006-01-02 15:04:05 -0700 MST"
View Source
const LayoutDateTimeZoneT = "2006-01-02T15:04:05.999999-07:00"
View Source
const LayoutTime = "15:04:05"

Variables

View Source
var Single = &single{}

Functions

func Any

func Any(timezone, layout string) string

Any 当前任意格式

func CheckTime

func CheckTime(timestamp int64, start string, end string, timezone string) int

CheckTime 检查时间 0未开始、1正常、2已结束,半闭合区间[start, end)

func CheckTimeNow

func CheckTimeNow(start string, end string, timezone string) int

CheckTimeNow 检查当前时间 0未开始、1正常、2已结束,半闭合区间[start, end)

func ClickhouseDatatimeRange added in v1.0.5

func ClickhouseDatatimeRange() (time.Time, time.Time)

clickhouse datetime类型底层以时间戳存储,不包含时区

func Date

func Date(timezone string) string

Date 当前日期

func DateTime

func DateTime(timezone string) string

DateTime 当前日期时间

func DiffInDays

func DiffInDays(t1, t2 int64) int

DiffInDays 时间戳相差天数

func GetWeekDay

func GetWeekDay(timezone string) (string, string)

GetWeekDay 获取本周起止日期

func ISOWeek

func ISOWeek(timezone string) string

ISOWeek 当前年周 例如2020_5

func ParseDateTime

func ParseDateTime(datetime string, timezone string) time.Time

ParseDateTime 解析日期时间

func ParseTimestamp

func ParseTimestamp(timestamp int64, timezone string) time.Time

ParseTimestamp 解析时间戳 秒级

func ToAny

func ToAny(timestamp int64, timezone string, layout string) string

ToAny 转成任意格式

func ToDate

func ToDate(timestamp int64, timezone string) string

ToDate 转成日期

func ToDateTime

func ToDateTime(timestamp int64, timezone string) string

ToDateTime 转成日期时间

func ToISOWeek

func ToISOWeek(timestamp int64, timezone string) string

ToISOWeek 转成年周 例如2020_5

func ToISOWeekByDate

func ToISOWeekByDate(datetime string, timezone string) string

ToISOWeekByDate 转成年周 例如2020_5

func ToUnix

func ToUnix(datetime string, timezone string) int64

ToUnix 转成时间戳

func Unix

func Unix(timezone string) int64

Unix 当前时间戳

Types

This section is empty.

Jump to

Keyboard shortcuts

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