Logo

Programming-Idioms

History of Idiom 98 > diff from v6 to v7

Edit summary for version 7 by :
New Go implementation by user [lck]

Version 6

2015-12-30, 01:35:38

Version 7

2016-01-01, 00:50:30

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"
Code
d := time.Unix(timestamp_ts, 0)
Comments bubble
The second argument is nanoseconds.
Doc URL
https://golang.org/pkg/time/#Unix