1 | //! The format described in RFC 3339. |
2 | |
3 | /// The format described in [RFC 3339](https://tools.ietf.org/html/rfc3339#section-5.6). |
4 | /// |
5 | /// Format example: 1985-04-12T23:20:50.52Z |
6 | /// |
7 | /// # Examples |
8 | #[cfg_attr (feature = "parsing" , doc = "```rust" )] |
9 | #[cfg_attr (not(feature = "parsing" ), doc = "```rust,ignore" )] |
10 | /// # use time::{format_description::well_known::Rfc3339, OffsetDateTime}; |
11 | /// # use time_macros::datetime; |
12 | /// assert_eq!( |
13 | /// OffsetDateTime::parse("1985-04-12T23:20:50.52Z" , &Rfc3339)?, |
14 | /// datetime!(1985-04-12 23:20:50.52 +00:00) |
15 | /// ); |
16 | /// # Ok::<_, time::Error>(()) |
17 | /// ``` |
18 | /// |
19 | #[cfg_attr (feature = "formatting" , doc = "```rust" )] |
20 | #[cfg_attr (not(feature = "formatting" ), doc = "```rust,ignore" )] |
21 | /// # use time::format_description::well_known::Rfc3339; |
22 | /// # use time_macros::datetime; |
23 | /// assert_eq!( |
24 | /// datetime!(1985-04-12 23:20:50.52 +00:00).format(&Rfc3339)?, |
25 | /// "1985-04-12T23:20:50.52Z" |
26 | /// ); |
27 | /// # Ok::<_, time::Error>(()) |
28 | /// ``` |
29 | #[derive (Debug, Clone, Copy, PartialEq, Eq)] |
30 | pub struct Rfc3339; |
31 | |