Documentation ¶
Index ¶
- func MarshalNorwegianDateTime(t time.Time) ([]byte, error)
- func MarshalRFC3339(t time.Time) ([]byte, error)
- func MarshalRFC3339Date(t time.Time) ([]byte, error)
- func MustLoadLocation(location string) *time.Location
- func SetLocalTimeZone(location string)
- func UnmarshalNorwegianDateTime(data []byte) (*time.Time, error)
- func UnmarshalRFC3339(data []byte) (*time.Time, error)
- func UnmarshalRFC3339Date(data []byte) (*time.Time, error)
- type Date
- type DateTime
- type NorwegianDateTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustLoadLocation ¶
func SetLocalTimeZone ¶
func SetLocalTimeZone(location string)
Sets time.Location, which is used in the localtime package
Types ¶
type Date ¶
time.Time wrapper that formats and parses dates in RFC3339 date format. In the code and when marshalling to/from JSON, it's stored in the local timezone.
Before marshalling/unmarshalling, remember to set the local timezone with SetLocalTimeZone().
func (Date) MarshalJSON ¶
func (*Date) UnmarshalJSON ¶
type DateTime ¶
time.Time wrapper that formats and parses dates in RFC3339 datetime format, with or without timezone specified. In the code, the time is stored in UTC, but when it is marshalled to/from JSON, it is converted to the local timezone.
Before marshalling/unmarshalling, remember to set the local timezone with SetLocalTimeZone().
func ParseDateTime ¶
Parses timestamp in RFC3339 datetime format (yyyy-mm-ddThh:mm:ssZ). If timezone is omitted, it's interpreted as a local time.
func (DateTime) MarshalJSON ¶
func (*DateTime) UnmarshalJSON ¶
type NorwegianDateTime ¶
time.Time wrapper that formats and parses dates in dd.mm.yyyy hh:mm:ss format. In the code, the time is stored in UTC, but when it is marshalled to/from JSON, it is converted to the local timezone.
Before marshalling/unmarshalling, remember to set the local timezone with SetLocalTimeZone().
func ParseNorwegianDateTime ¶
func ParseNorwegianDateTime(timestamp string) (*NorwegianDateTime, error)
Parses timestamp in dd.mm.yyyy hh:mm:ss format, interpreted as local time.
func (NorwegianDateTime) MarshalJSON ¶
func (t NorwegianDateTime) MarshalJSON() ([]byte, error)
func (*NorwegianDateTime) String ¶
func (t *NorwegianDateTime) String() string
func (*NorwegianDateTime) UnmarshalJSON ¶
func (t *NorwegianDateTime) UnmarshalJSON(data []byte) error