rfctime

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 4 Imported by: 9

Documentation

Index

Constants

View Source
const (
	RFC3339DateNano       = "2006-01-02T15:04:05.999999999"
	RFC3339DateNanoSpace  = "2006-01-02 15:04:05.999999999"
	RFC3339DateNanoZSpace = "2006-01-02 15:04:05.999999999Z07:00"

	RFC3339DateSec       = "2006-01-02T15:04:05"
	RFC3339DateSecZ      = "2006-01-02T15:04:05Z07:00"
	RFC3339DateSecSpace  = "2006-01-02 15:04:05"
	RFC3339DateSecZSpace = "2006-01-02 15:04:05Z07:00"

	RFC3339DateMin       = "2006-01-02T15:04"
	RFC3339DateMinZ      = "2006-01-02T15:04Z07:00"
	RFC3339DateMinSpace  = "2006-01-02 15:04"
	RFC3339DateMinZSpace = "2006-01-02 15:04Z07:00"

	RFC3339DateHour       = "2006-01-02T15"
	RFC3339DateHourZ      = "2006-01-02T15Z07:00"
	RFC3339DateHourSpace  = "2006-01-02 15"
	RFC3339DateHourZSpace = "2006-01-02 15Z07:00"

	RFC3339DateOnly  = "2006-01-02"
	RFC3339DateOnlyZ = "2006-01-02Z07:00"
)

The following format is used to parse the abbreviated form of RFC3339 date-time.

View Source
const RFC3339DateTimeFormat string = "2006-01-02T15:04:05.999-07:00"

Format string for date-time in RFC3339, disallowing Z as time-offset.

Use it to stringify time.Time forcing timezone offset not to use "Z".

View Source
const RFC3339DateTimeFormatZ string = time.RFC3339Nano

Format string for date-time in RFC3339, allowing Z as time-offset.

Use it to parse RFC3339 date-time expression.

Variables

This section is empty.

Functions

This section is empty.

Types

type RFC3339

type RFC3339 time.Time

date-time in https://www.ietf.org/rfc/rfc3339.txt . this is known as a subset of ISO8601 extended format.

This type is useful to interchange timestamps via network/file.

func ParseLooseRFC3339

func ParseLooseRFC3339(s string) (RFC3339, error)

When you need to parse string with the abbreviated forms of RFC3339 date-time, use this function.

func ParseRFC3339DateTime

func ParseRFC3339DateTime(s string) (RFC3339, error)

Parse string to ISO8601 time.

It trancates resolution to milli second.

func (RFC3339) Equal

func (rfctime RFC3339) Equal(other RFC3339) bool

func (RFC3339) Equiv

func (rfctime RFC3339) Equiv(other interface{ Time() time.Time }) bool

return true if this and other `.Time()` are equal. If both this and other are nil, also return true.

otherwise, return false.

func (RFC3339) MarshalJSON

func (t RFC3339) MarshalJSON() ([]byte, error)

implement encoding/json.Marshaller

func (RFC3339) String

func (t RFC3339) String() string

get string expression.

It formatted by RFC3339DateTimeFormat.

When you need other format, use

func (RFC3339) Time

func (rfctime RFC3339) Time() time.Time

func (*RFC3339) UnmarshalJSON

func (t *RFC3339) UnmarshalJSON(b []byte) error

implement encoding/json.Unmarshaller

Jump to

Keyboard shortcuts

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