date

package
v6.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package date contains logic for handling operations on datetime values.

Index

Constants

View Source
const DefaultFormat = "2006-01-02T15:04:05Z"

DefaultFormat is the datetime format used across the provider.

Variables

View Source
var ErrDateFormat = errors.New("unable to parse date")

ErrDateFormat is returned when there is an error parsing a string date.

View Source
var ErrMarshal = errors.New("unable to marshal date")

ErrMarshal is returned when there is an error marshaling a time.Time date.

Functions

func FormatRFC3339 added in v6.3.0

func FormatRFC3339(t time.Time) string

FormatRFC3339 returns a textual representation of time formatted according to the RFC3339 standard. RFC3339 is a subset of ISO 8601 producing the format "2006-01-02T15:04:05Z" (for a UTC time) which is commonly used in the Edge API.

func Parse

func Parse(value string) (time.Time, error)

Parse parses the given string datetime using the default DefaultFormat format.

func ParseFormat

func ParseFormat(format, value string) (time.Time, error)

ParseFormat parses the given string datetime using the provided format.

func ToString added in v6.3.0

func ToString(value time.Time) (string, error)

ToString returns given date in the string format

Types

This section is empty.

Jump to

Keyboard shortcuts

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