Logo

Programming-Idioms

History of Idiom 98 > diff from v7 to v8

Edit summary for version 8 by :
[Go] misread

Version 7

2016-01-01, 00:50:30

Version 8

2016-01-01, 00:50:49

Idiom #98 Epoch seconds to date object

Convert a timestamp ts (number of seconds in epoch-time) to a date with time d. E.g. 0 -> 1970-01-01 00:00:00

Idiom #98 Epoch seconds to date object

Convert a timestamp ts (number of seconds in epoch-time) to a date with time d. E.g. 0 -> 1970-01-01 00:00:00

Imports
import "time"
Imports
import "time"
Code
d := time.Unix(timestamp_ts, 0)
Code
d := time.Unix(ts, 0)
Comments bubble
The second argument is nanoseconds.
Comments bubble
The second argument is nanoseconds.
Doc URL
https://golang.org/pkg/time/#Unix
Doc URL
https://golang.org/pkg/time/#Unix