Logo

Programming-Idioms

History of Idiom 98 > diff from v15 to v16

Edit summary for version 16 by GobbleCock:
New Rust implementation by user [GobbleCock]

Version 15

2017-10-28, 10:26:36

Version 16

2018-06-12, 17:48:40

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
extern crate chrono;
use chrono::prelude::*:
Code
let d = NaiveDateTime::from_timestamp(ts, 0);
Doc URL
https://docs.rs/chrono/0.4.3/chrono/naive/struct.NaiveDateTime.html#method.from_timestamp