datetime

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package datetime provides functions to convert uint32 timestamp to time.Time and vice-versa. And also some other functions to handle time-related items such as calculate offset timezone from given date time and local date time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Epoch

func Epoch() time.Time

Epoch returns FIT epoch (31 Dec 1989 00:00:000 UTC) as time.Time

func ToLocalTime

func ToLocalTime(t time.Time, tzOffsetHours int) time.Time

ToLocalTime converts time in local time zone by specifying the time zone offset hours (+7 for GMT+7).

func ToTime

func ToTime(value uint32) time.Time

ToTime converts uint32 value into time.Time.

func ToUint32

func ToUint32(t time.Time) uint32

ToUint32 converts t into uint32 FIT representative time value.

func TzOffsetHours

func TzOffsetHours(localDateTime, dateTime time.Time) int

TzOffsetHours calculates time zone offset.

formula ilustration: (activity.LocalTimestamp - activity.Timestamp) / 3600

func TzOffsetHoursFromUint32 added in v0.4.0

func TzOffsetHoursFromUint32(localDateTime, dateTime uint32) int

TzOffsetHoursFromUint32 is similar to TzOffsetHours but it took uint32 as parameters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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