timeutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeOffset = 8 * 3600  //8 hour offset
	HalfOffset = 12 * 3600 //Half-day hourly offset
)

Variables

This section is empty.

Functions

func DaysBetweenTimestamps added in v1.1.0

func DaysBetweenTimestamps(timezone string, timestamp int64) (int, error)

func GetCurDayHalfTimeFormat

func GetCurDayHalfTimeFormat() string

Get the formatted time at 12 o'clock of the day, the format is "2006-01-02_12-00-00"

func GetCurDayHalfTimestamp

func GetCurDayHalfTimestamp() int64

Get the timestamp at 12 o'clock on the day

func GetCurDayZeroTimeFormat

func GetCurDayZeroTimeFormat() string

Get the formatted time at 0 o'clock of the day, the format is "2006-01-02_00-00-00"

func GetCurDayZeroTimestamp

func GetCurDayZeroTimestamp() int64

Get the timestamp at 0 o'clock of the day

func GetCurrentTimeFormatted

func GetCurrentTimeFormatted() string

func GetCurrentTimestampByMill

func GetCurrentTimestampByMill() int64

Get the current timestamp by Mill

func GetCurrentTimestampByNano

func GetCurrentTimestampByNano() int64

Get the current timestamp by Nano

func GetCurrentTimestampBySecond

func GetCurrentTimestampBySecond() int64

Get the current timestamp by Second

func GetTimeStampByFormat

func GetTimeStampByFormat(datetime string) string

GetTimeStampByFormat convert string to unix timestamp

func GetTimestampByTimezone added in v1.1.0

func GetTimestampByTimezone(timezone string) (int64, error)

GetTimestampByTimezone get specific timestamp by timezone

func IsNthDayCycle added in v1.1.0

func IsNthDayCycle(timezone string, startTimestamp int64, n int) (bool, error)

func IsNthMonthCycle added in v1.1.0

func IsNthMonthCycle(timezone string, startTimestamp int64, n int) (bool, error)

IsNthMonthCycle checks if the current day is part of an N-month cycle starting from a given start timestamp.

func IsNthWeekCycle added in v1.1.0

func IsNthWeekCycle(timezone string, startTimestamp int64, n int) (bool, error)

IsNthWeekCycle checks if the current day is part of an N-week cycle starting from a given start timestamp.

func IsSameDayOfMonth added in v1.1.0

func IsSameDayOfMonth(timezone string, timestamp int64) (bool, error)

func IsSameWeekday added in v1.1.0

func IsSameWeekday(timezone string, timestamp int64) (bool, error)

IsSameWeekday judge current day and specific day is the same of a week.

func IsWeekday added in v1.1.0

func IsWeekday(timestamp int64) bool

func TimeStringFormatTimeUnix

func TimeStringFormatTimeUnix(timeFormat string, timeSrc string) int64

TimeStringFormatTimeUnix convert string to unix timestamp

func TimeStringToTime

func TimeStringToTime(timeString string) (time.Time, error)

TimeStringToTime convert string to time.Time

func TimeToString

func TimeToString(t time.Time) string

TimeToString convert time.Time to string

func UnixMillSecondToTime

func UnixMillSecondToTime(millSecond int64) time.Time

UnixMillSecondToTime convert millSecond to time.Time type

func UnixNanoSecondToTime

func UnixNanoSecondToTime(nanoSecond int64) time.Time

Convert nano timestamp to time.Time type

func UnixSecondToTime

func UnixSecondToTime(second int64) time.Time

Convert timestamp to time.Time type

Types

This section is empty.

Jump to

Keyboard shortcuts

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