timestamp

package
v2.35.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDateTime added in v2.35.0

func AddDateTime(now any, offset string) (ts time.Time, err error)

AddDateTime adds an offset to a given timestamp (either as string or time.Time)

func DecodeC8yTimestamp

func DecodeC8yTimestamp(value string) string

func EncodeC8yTimestamp

func EncodeC8yTimestamp(value string) string

func FormatC8yDate

func FormatC8yDate(timestamp time.Time, encode bool, layout string) string

func FormatC8yTimestamp

func FormatC8yTimestamp(timestamp time.Time, encode bool) string

func GetTimestampUsingOffset

func GetTimestampUsingOffset(now time.Time, offsetDuration string) (*time.Time, error)

GetTimestampUsingOffset returns a timestamp relative to a base timestamp example: +1d3w4mo-7y6h4m

func ParseDuration

func ParseDuration(duration string) (time.Duration, error)

ParseDuration converts a duration string representation to a time.Duration The duration is in reference to now.

func ParseDurationRelativeToNow

func ParseDurationRelativeToNow(offsetDuration string) (*time.Time, error)

ParseDurationRelativeToNow returns a timestamp relative to now Examples ParseDurationRelativeToNow("-1m")

func ParseTimestamp

func ParseTimestamp(value string) (ts time.Time, err error)

ParseTimestamp parse a time stamp (accepts both relative and full timestamps)

func TryGetDate

func TryGetDate(value string, encode bool, layout string) (string, error)

func TryGetTimestamp

func TryGetTimestamp(value string, encode bool, utc bool) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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