datetime

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Helper functions for handling time.Time objects.

Index

Constants

View Source
const (
	FormatDate           = "2006-01-02"
	FormatDatetime       = "2006-01-02 15:04:05"
	FormatDatetimeTZ     = "2006-01-02T15:04:05Z"
	FormatDatetimeTZnano = "2006-01-02T15:04:05.000000Z07"
	FormatDatetimeMilli  = "2006-01-02 15:04:05.000"
)

Variables

This section is empty.

Functions

func FirstOfMonth

func FirstOfMonth(t time.Time) time.Time

Returns a time.Time timestamp of first day of given month. Time format:

"2006-01-02T15:04:05Z"

func MicrosecondsToTime added in v0.2.3

func MicrosecondsToTime(tm int64) time.Time

Converts microseconds to time.Time object.

func NanosecondsToTime

func NanosecondsToTime(tm int64) time.Time

Converts nanoseconds to time.Time object.

func ParseTime

func ParseTime(t string) time.Time

Converts string to time.Time object. Time format:

"2006-01-02T15:04:05Z"

func TimeToMicroseconds

func TimeToMicroseconds(tm time.Time) int64

Converts time.Time object to microseconds.

func ZeroHour added in v0.25.6

func ZeroHour(t time.Time) time.Time

Returns a time.Time timestamp of zero hour of given date. Time format:

"2006-01-02T15:04:05Z"

Types

This section is empty.

Jump to

Keyboard shortcuts

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