tz

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UTCDateToTz

func UTCDateToTz(utcDateString string, timezone string) (string, error)

UTCDateToTz converts a UTC date string to the specified timezone. It accepts date strings in "YYYY-MM-DD" format.

Example:

dateInNewYork, err := UTCDateToTz("2022-01-01", "America/New_York")

Parameters:

  • utcDateString: a string representing the UTC date in "YYYY-MM-DD" format.
  • timezone: a string representing the timezone (e.g., "America/New_York").

Returns:

  • a string representing the converted date in "YYYY-MM-DD" format, or an empty string and an error if parsing fails.

func UTCDatetimeToTz

func UTCDatetimeToTz(utcDatetimeString string, timezone string) (string, error)

UTCDatetimeToTz converts a UTC datetime string to the specified timezone. It accepts datetime strings in "YYYY-MM-DD HH:MM" format.

Example:

datetimeInNewYork, err := UTCDatetimeToTz("2022-01-01 10:00", "America/New_York")

Parameters:

  • utcDatetimeString: a string representing the UTC datetime in "YYYY-MM-DD HH:MM" format.
  • timezone: a string representing the timezone (e.g., "America/New_York").

Returns:

  • a string representing the converted datetime in "YYYY-MM-DD HH:MM" format, or an empty string and an error if parsing fails.

func UTCTimeToTz

func UTCTimeToTz(utcTimeString string, timezone string) string

UTCTimeToTz converts a UTC time string to the specified timezone. It accepts time strings in "HH:MM" format.

Example:

timeInNewYork, err := UTCTimeToTz("10:00", "America/New_York")

Parameters:

  • utcTimeString: a string representing the UTC time in "HH:MM" format.
  • timezone: a string representing the timezone (e.g., "America/New_York").

Returns:

  • a string representing the converted time in "HH:MM" format, or an empty string and an error if parsing fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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