Discover Packages
github.com/zhouzhuojie/iso8601ms
package
module
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Mar 11, 2021
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 2
Opens a new window with list of known importers.
README
README
¶
iso8601ms
Package iso8601 is a simple Go package for encoding time.Time
in JSON in ISO 8601
format with millisecond precision, with the converted UTC timezone.
Standard iso8601 with millisecond precision: https://docs.jsonata.org/date-time
t := iso8601ms.Time(time.Now())
jsonBytes, _ := json.Marshal(t)
fmt.Println(string(jsonBytes))
// "2021-03-11T01:14:28.625Z"
// Same as JavaScript's Date().toISOString()
Expand ▾
Collapse ▴
Documentation
¶
Package iso8601ms package encodes and decodes time.Time in JSON in
ISO 8601 with millisecond precision format
Time is a iso8601ms struct
MarshalJSON implements the json.Marshaler interface.
UnmarshalJSON implements the json.Unmarshaler interface.
The time is expected to be a quoted string in RFC 3339 format.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.