time

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package time contains low-level utility functions for working with time.Time values and timezones.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTimeZone

func ConvertTimeZone(datetime time.Time, fromLocation string, toLocation string) (time.Time, bool)

ConvertTimeZone converts |datetime| from one timezone to another. |fromLocation| and |toLocation| can be either the name of a timezone (e.g. "UTC") or a MySQL-formatted timezone offset (e.g. "+01:00"). If the time was converted successfully, then the second return value will be true, otherwise the time was not able to be converted.

func MySQLOffsetToDuration

func MySQLOffsetToDuration(d string) (time.Duration, error)

MySQLOffsetToDuration takes in a MySQL timezone offset (e.g. "+01:00") and returns it as a time.Duration. If any problems are encountered, an error is returned.

func SecondsToMySQLOffset

func SecondsToMySQLOffset(offset int) string

SecondsToMySQLOffset takes in a timezone offset in seconds (as returned by time.Time.Zone()) and returns it as a MySQL timezone offset (e.g. "+01:00").

func SystemTimezoneOffset

func SystemTimezoneOffset() string

SystemTimezoneOffset returns the current system timezone offset as a MySQL timezone offset (e.g. "+01:00").

Types

This section is empty.

Jump to

Keyboard shortcuts

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