Merge pull request #185 from kosta/readme-timestamps

Add doc comment to lib.rs: Conversion from and to EPOCH timestamps
This commit is contained in:
Brandon W Maister 2017-09-26 20:50:59 -04:00 committed by GitHub
commit b3adf050f5
1 changed files with 11 additions and 0 deletions

View File

@ -288,6 +288,17 @@
//! assert!(Utc.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err()); //! assert!(Utc.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err());
//! ``` //! ```
//! //!
//! ### Conversion from and to EPOCH timestamps
//!
//! Use [`Utc.timestamp(seconds, nanoseconds)`](./offset/trait.TimeZone.html#method.timestamp)
//! to construct a [`DateTime<Utc>`](./struct.DateTime.html) from a UNIX timestamp
//! (seconds, nanoseconds that passed since January 1st 1970).
//!
//! Use [`DateTime.timestamp`](./struct.DateTime.html#method.timestamp) to get the timestamp (in seconds)
//! from a [`DateTime`](./struct.DateTime.html). Additionally, you can use
//! [`DateTime.timestamp_subsec_nanos`](./struct.DateTime.html#method.timestamp_subsec_nanos)
//! to get the number of additional number of nanoseconds.
//!
//! ### Individual date //! ### Individual date
//! //!
//! Chrono also provides an individual date type ([**`Date`**](./struct.Date.html)). //! Chrono also provides an individual date type ([**`Date`**](./struct.Date.html)).