Logo

Programming-Idioms

History of Idiom 98 > diff from v9 to v10

Edit summary for version 10 by :
New Ruby implementation by user [mg]

Version 9

2016-01-01, 01:44:27

Version 10

2016-02-16, 19:50:51

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
require 'date'
Code
d = DateTime.strptime(ts, '%s')