time

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package time provides helpers to work with time.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDuration = errors.New("time: invalid duration")
	ErrInvalidHour     = errors.New("time: invalid hour")
	ErrInvalidLocation = errors.New("time: invalid location")
	ErrInvalidTimezone = errors.New("time: invalid timezone")
)

Functions

func GetCalculateTime

func GetCalculateTime(currentTime time.Time, d string) (time.Time, error)

GetCalculateTime returns new time with added duration to current time.

func GetTimeInTimezone added in v2.2.0

func GetTimeInTimezone(t time.Time, tz string) (time.Time, error)

GetTimeInTimezone returns the time in given timezone.

func GetTimeNow

func GetTimeNow() time.Time

GetTimeNow returns the current local time.

func GetTimeNowInLocation

func GetTimeNowInLocation(loc string) (time.Time, error)

GetTimeNowInLocation returns the current time in location.

func NormalizeHourInTimezone

func NormalizeHourInTimezone(hr int, tz int) (int, error)

NormalizeHourInTimezone returns the hour hr in the given timezone tz. For example: UTC 0:00 in +8 = NormalizeHourInTimezone(0, 8) => 8:00 UTC 20:00 in +8 = NormalizeHourInTimezone(20, 8) => 4:00 UTC 20:00 in -22 = NormalizeHourInTimezone(20, -22) => 22:00

Types

This section is empty.

Directories

Path Synopsis
Package timezone provides helpers to work with timezone.
Package timezone provides helpers to work with timezone.

Jump to

Keyboard shortcuts

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