tz

package
v0.0.0-...-9c21ab8 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FullFormat = "2006-01-02 15:04:05" //最常用的格式
	DayFormat  = "2006-01-02"
)

Variables

This section is empty.

Functions

func ChinaTimezone

func ChinaTimezone() *time.Location

func Cycle

func Cycle(what func(), delay time.Duration, stop chan struct{})

循环,固定延迟时间,会立刻执行一次

func DynamicCycle

func DynamicCycle(what func(), delayAddr *time.Duration, stop chan struct{})

循环,动态间隔时间,会立刻执行一次

func DynamicSchedule

func DynamicSchedule(what func(), delayAddr *time.Duration, stop chan struct{})

动态频率,不会立刻执行

func GetLocalStr

func GetLocalStr(base time.Time) string

GetLocalStr change utc time to local date str

func GetNowTs

func GetNowTs() int64

func GetNowTsMs

func GetNowTsMs() int64

func GetTodayStr

func GetTodayStr() string

func IsSameDay

func IsSameDay(l time.Time, r time.Time) bool

IsSameDay check if two time is same day locally

func LocalNow

func LocalNow() time.Time

func Schedule

func Schedule(what func(), delay time.Duration, stop chan struct{})

固定频率,不会立刻执行

func UTCToLocal

func UTCToLocal(base time.Time) time.Time

如果想要将本地时间转换成UTC,直接用UTC()方法即可 如果解析字符串,对应的是本地时间且字符串中没有时区,使用time.ParseInLocation(ChinaTimeZone())

Types

This section is empty.

Jump to

Keyboard shortcuts

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