Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( // Layout we use to format the time Layout = time.RFC3339 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Formatted ¶
Formatted represents a custom time.Time for consistency across our application
Example ¶
someTime, err := time.Parse("2006-01-02T15:04:05Z07:00", "2018-12-24T08:41:53Z") if err != nil { fmt.Println(err.Error()) } customTime := Formatted(someTime) fmt.Println(customTime)
Output: 2018-12-24T08:41:53Z
Example (WithTimeZone) ¶
someTime, err := time.Parse("2006-01-02T15:04:05Z07:00", "2018-12-24T08:41:53+07:00") if err != nil { fmt.Println(err.Error()) } customTime := Formatted(someTime) fmt.Println(customTime)
Output: 2018-12-24T08:41:53+07:00
func NewUTCTime ¶
func NewUTCTime() Formatted
NewUTCTime returns a Formatted object with location set to UTC
func (Formatted) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Formatted) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
Click to show internal directories.
Click to hide internal directories.