localtime

package
v0.18.0-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetLocalTimeCallStack = testutils.NewCallStack()
View Source
var GetTimeInZoneCallStack = testutils.NewCallStack()
View Source
var GetTimeLocationCallStack = testutils.NewCallStack()

Functions

func GetLocation

func GetLocation(tz string) (*time.Location, error)

GetLocation returns the time.Location for the given time zone. The time zone should be a valid IANA time zone identifier, such as "America/New_York".

func GetTimeZone

func GetTimeZone() string

GetTimeZone returns the local time zone identifier, in IANA format.

func IsValidTimeZone added in v0.17.0

func IsValidTimeZone(tz string) bool

IsValidTimeZone returns true if the given time zone is valid.

func Now

func Now() (time.Time, error)

Now returns the current local time. The time zone is determined in the following order of precedence: - If the X-Time-Zone header is present in the request, the time zone is set to the value of the header. - If the TZ environment variable is set on the host, the time zone is set to the value of the variable. - Otherwise, the time zone is set to the host's local time zone.

func NowInZone

func NowInZone(tz string) (time.Time, error)

NowInZone returns the current time in the given time zone. The time zone should be a valid IANA time zone identifier, such as "America/New_York".

Types

This section is empty.

Jump to

Keyboard shortcuts

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