• Home
  • Raw
  • Download

Lines Matching refs:DateTime

70 pub struct DateTime<Tz: TimeZone> {  struct
76 pub const MIN_DATETIME: DateTime<Utc> = DateTime { datetime: naive::MIN_DATETIME, offset: Utc };
78 pub const MAX_DATETIME: DateTime<Utc> = DateTime { datetime: naive::MAX_DATETIME, offset: Utc };
80 impl<Tz: TimeZone> DateTime<Tz> { implementation
95 pub fn from_utc(datetime: NaiveDateTime, offset: Tz::Offset) -> DateTime<Tz> { in from_utc()
96 DateTime { datetime: datetime, offset: offset } in from_utc()
212 pub fn with_timezone<Tz2: TimeZone>(&self, tz: &Tz2) -> DateTime<Tz2> { in with_timezone()
220 pub fn checked_add_signed(self, rhs: OldDuration) -> Option<DateTime<Tz>> { in checked_add_signed()
230 pub fn checked_sub_signed(self, rhs: OldDuration) -> Option<DateTime<Tz>> { in checked_sub_signed()
239 pub fn signed_duration_since<Tz2: TimeZone>(self, rhs: DateTime<Tz2>) -> OldDuration { in signed_duration_since()
257 impl From<DateTime<Utc>> for DateTime<FixedOffset> { implementation
262 fn from(src: DateTime<Utc>) -> Self { in from()
269 impl From<DateTime<Utc>> for DateTime<Local> { implementation
273 fn from(src: DateTime<Utc>) -> Self { in from()
279 impl From<DateTime<FixedOffset>> for DateTime<Utc> { implementation
284 fn from(src: DateTime<FixedOffset>) -> Self { in from()
291 impl From<DateTime<FixedOffset>> for DateTime<Local> { implementation
296 fn from(src: DateTime<FixedOffset>) -> Self { in from()
303 impl From<DateTime<Local>> for DateTime<Utc> { implementation
308 fn from(src: DateTime<Local>) -> Self { in from()
315 impl From<DateTime<Local>> for DateTime<FixedOffset> { implementation
320 fn from(src: DateTime<Local>) -> Self { in from()
326 fn map_local<Tz: TimeZone, F>(dt: &DateTime<Tz>, mut f: F) -> Option<DateTime<Tz>> in map_local()
333 impl DateTime<FixedOffset> { implementation
347 pub fn parse_from_rfc2822(s: &str) -> ParseResult<DateTime<FixedOffset>> { in parse_from_rfc2822()
359 pub fn parse_from_rfc3339(s: &str) -> ParseResult<DateTime<FixedOffset>> { in parse_from_rfc3339()
386 pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<DateTime<FixedOffset>> { in parse_from_str()
393 impl<Tz: TimeZone> DateTime<Tz> implementation
535 impl<Tz: TimeZone> Datelike for DateTime<Tz> { implementation
574 fn with_year(&self, year: i32) -> Option<DateTime<Tz>> { in with_year()
579 fn with_month(&self, month: u32) -> Option<DateTime<Tz>> { in with_month()
584 fn with_month0(&self, month0: u32) -> Option<DateTime<Tz>> { in with_month0()
589 fn with_day(&self, day: u32) -> Option<DateTime<Tz>> { in with_day()
594 fn with_day0(&self, day0: u32) -> Option<DateTime<Tz>> { in with_day0()
599 fn with_ordinal(&self, ordinal: u32) -> Option<DateTime<Tz>> { in with_ordinal()
604 fn with_ordinal0(&self, ordinal0: u32) -> Option<DateTime<Tz>> { in with_ordinal0()
609 impl<Tz: TimeZone> Timelike for DateTime<Tz> { implementation
628 fn with_hour(&self, hour: u32) -> Option<DateTime<Tz>> { in with_hour()
633 fn with_minute(&self, min: u32) -> Option<DateTime<Tz>> { in with_minute()
638 fn with_second(&self, sec: u32) -> Option<DateTime<Tz>> { in with_second()
643 fn with_nanosecond(&self, nano: u32) -> Option<DateTime<Tz>> { in with_nanosecond()
649 impl<Tz: TimeZone> Copy for DateTime<Tz> where <Tz as TimeZone>::Offset: Copy {} implementation
650 unsafe impl<Tz: TimeZone> Send for DateTime<Tz> where <Tz as TimeZone>::Offset: Send {} implementation
652 impl<Tz: TimeZone, Tz2: TimeZone> PartialEq<DateTime<Tz2>> for DateTime<Tz> { implementation
653 fn eq(&self, other: &DateTime<Tz2>) -> bool { in eq()
658 impl<Tz: TimeZone> Eq for DateTime<Tz> {} implementation
660 impl<Tz: TimeZone, Tz2: TimeZone> PartialOrd<DateTime<Tz2>> for DateTime<Tz> { implementation
676 fn partial_cmp(&self, other: &DateTime<Tz2>) -> Option<Ordering> { in partial_cmp()
681 impl<Tz: TimeZone> Ord for DateTime<Tz> { implementation
682 fn cmp(&self, other: &DateTime<Tz>) -> Ordering { in cmp()
687 impl<Tz: TimeZone> hash::Hash for DateTime<Tz> { implementation
693 impl<Tz: TimeZone> Add<OldDuration> for DateTime<Tz> { implementation
694 type Output = DateTime<Tz>;
697 fn add(self, rhs: OldDuration) -> DateTime<Tz> { in add()
702 impl<Tz: TimeZone> Sub<OldDuration> for DateTime<Tz> { implementation
703 type Output = DateTime<Tz>;
706 fn sub(self, rhs: OldDuration) -> DateTime<Tz> { in sub()
711 impl<Tz: TimeZone> Sub<DateTime<Tz>> for DateTime<Tz> { implementation
715 fn sub(self, rhs: DateTime<Tz>) -> OldDuration { in sub()
720 impl<Tz: TimeZone> fmt::Debug for DateTime<Tz> { implementation
726 impl<Tz: TimeZone> fmt::Display for DateTime<Tz> implementation
735 impl str::FromStr for DateTime<Utc> { implementation
738 fn from_str(s: &str) -> ParseResult<DateTime<Utc>> { in from_str()
739 s.parse::<DateTime<FixedOffset>>().map(|dt| dt.with_timezone(&Utc)) in from_str()
744 impl str::FromStr for DateTime<Local> { implementation
747 fn from_str(s: &str) -> ParseResult<DateTime<Local>> { in from_str()
748 s.parse::<DateTime<FixedOffset>>().map(|dt| dt.with_timezone(&Local)) in from_str()
753 impl From<SystemTime> for DateTime<Utc> { implementation
754 fn from(t: SystemTime) -> DateTime<Utc> { in from()
773 impl From<SystemTime> for DateTime<Local> { implementation
774 fn from(t: SystemTime) -> DateTime<Local> { in from()
775 DateTime::<Utc>::from(t).with_timezone(&Local) in from()
780 impl<Tz: TimeZone> From<DateTime<Tz>> for SystemTime {
781 fn from(dt: DateTime<Tz>) -> SystemTime { in from()
796 impl From<js_sys::Date> for DateTime<Utc> { implementation
797 fn from(date: js_sys::Date) -> DateTime<Utc> { in from()
798 DateTime::<Utc>::from(&date) in from()
803 impl From<&js_sys::Date> for DateTime<Utc> { implementation
804 fn from(date: &js_sys::Date) -> DateTime<Utc> { in from()
809 DateTime::from_utc(naive, Utc) in from()
814 impl From<DateTime<Utc>> for js_sys::Date {
815 fn from(date: DateTime<Utc>) -> js_sys::Date { in from()
836 let utc_dt2: DateTime<Utc> = cdt_dt.into(); in test_auto_conversion()
843 FUtc: Fn(&DateTime<Utc>) -> Result<String, E>, in test_encodable_json()
844 FFixed: Fn(&DateTime<FixedOffset>) -> Result<String, E>, in test_encodable_json()
868 FUtc: Fn(&str) -> Result<DateTime<Utc>, E>, in test_decodable_json()
869 FFixed: Fn(&str) -> Result<DateTime<FixedOffset>, E>, in test_decodable_json()
870 FLocal: Fn(&str) -> Result<DateTime<Local>, E>, in test_decodable_json()
874 fn norm<Tz: TimeZone>(dt: &Option<DateTime<Tz>>) -> Option<(&DateTime<Tz>, &Tz::Offset)> { in test_decodable_json()
922 fn norm<Tz: TimeZone>(dt: &Option<DateTime<Tz>>) -> Option<(&DateTime<Tz>, &Tz::Offset)> { in test_decodable_json_timestamps()
927 norm(&utc_from_str("0").ok().map(DateTime::from)), in test_decodable_json_timestamps()
931 norm(&utc_from_str("-1").ok().map(DateTime::from)), in test_decodable_json_timestamps()
936 norm(&fixed_from_str("0").ok().map(DateTime::from)), in test_decodable_json_timestamps()
940 norm(&fixed_from_str("-1").ok().map(DateTime::from)), in test_decodable_json_timestamps()
956 use super::DateTime;
964 impl<Tz: TimeZone> Encodable for DateTime<Tz> { implementation
983 impl Decodable for DateTime<FixedOffset> { implementation
984 fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<FixedOffset>, D::Error> { in decode()
986 .parse::<DateTime<FixedOffset>>() in decode()
999 impl Decodable for DateTime<Utc> { implementation
1000 fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<Utc>, D::Error> { in decode()
1002 .parse::<DateTime<FixedOffset>>() in decode()
1012 pub struct TsSeconds<Tz: TimeZone>(DateTime<Tz>);
1015 impl<Tz: TimeZone> From<TsSeconds<Tz>> for DateTime<Tz> { implementation
1018 fn from(obj: TsSeconds<Tz>) -> DateTime<Tz> { in from()
1025 type Target = DateTime<Tz>;
1040 impl Decodable for DateTime<Local> { implementation
1041 fn decode<D: Decoder>(d: &mut D) -> Result<DateTime<Local>, D::Error> { in decode()
1042 match d.read_str()?.parse::<DateTime<FixedOffset>>() { in decode()
1083 use super::DateTime;
1160 use {DateTime, Utc};
1196 pub fn serialize<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error> in serialize()
1231 pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error> in deserialize()
1239 type Value = DateTime<Utc>;
1246 fn visit_i64<E>(self, value: i64) -> Result<DateTime<Utc>, E> in visit_i64()
1257 fn visit_u64<E>(self, value: u64) -> Result<DateTime<Utc>, E> in visit_u64()
1312 use {DateTime, Utc};
1348 pub fn serialize<S>(opt: &Option<DateTime<Utc>>, serializer: S) -> Result<S::Ok, S::Error> in serialize()
1386 pub fn deserialize<'de, D>(d: D) -> Result<Option<DateTime<Utc>>, D::Error> in deserialize()
1396 type Value = Option<DateTime<Utc>>;
1403 fn visit_some<D>(self, d: D) -> Result<Option<DateTime<Utc>>, D::Error> in visit_some()
1411 fn visit_none<E>(self) -> Result<Option<DateTime<Utc>>, E> in visit_none()
1419 fn visit_unit<E>(self) -> Result<Option<DateTime<Utc>>, E> in visit_unit()
1469 use {DateTime, Utc};
1505 pub fn serialize<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error> in serialize()
1540 pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error> in deserialize()
1548 type Value = DateTime<Utc>;
1555 fn visit_i64<E>(self, value: i64) -> Result<DateTime<Utc>, E> in visit_i64()
1566 fn visit_u64<E>(self, value: u64) -> Result<DateTime<Utc>, E> in visit_u64()
1618 use {DateTime, Utc};
1654 pub fn serialize<S>(opt: &Option<DateTime<Utc>>, serializer: S) -> Result<S::Ok, S::Error> in serialize()
1704 pub fn deserialize<'de, D>(d: D) -> Result<Option<DateTime<Utc>>, D::Error> in deserialize()
1715 type Value = Option<DateTime<Utc>>;
1722 fn visit_some<D>(self, d: D) -> Result<Option<DateTime<Utc>>, D::Error> in visit_some()
1730 fn visit_none<E>(self) -> Result<Option<DateTime<Utc>>, E> in visit_none()
1738 fn visit_unit<E>(self) -> Result<Option<DateTime<Utc>>, E> in visit_unit()
1788 use {DateTime, Utc};
1824 pub fn serialize<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error> in serialize()
1859 pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error> in deserialize()
1867 type Value = DateTime<Utc>;
1874 fn visit_i64<E>(self, value: i64) -> Result<DateTime<Utc>, E> in visit_i64()
1882 fn visit_u64<E>(self, value: u64) -> Result<DateTime<Utc>, E> in visit_u64()
1931 use {DateTime, Utc};
1967 pub fn serialize<S>(opt: &Option<DateTime<Utc>>, serializer: S) -> Result<S::Ok, S::Error> in serialize()
2005 pub fn deserialize<'de, D>(d: D) -> Result<Option<DateTime<Utc>>, D::Error> in deserialize()
2015 type Value = Option<DateTime<Utc>>;
2022 fn visit_some<D>(self, d: D) -> Result<Option<DateTime<Utc>>, D::Error> in visit_some()
2030 fn visit_none<E>(self) -> Result<Option<DateTime<Utc>>, E> in visit_none()
2038 fn visit_unit<E>(self) -> Result<Option<DateTime<Utc>>, E> in visit_unit()
2047 impl<Tz: TimeZone> ser::Serialize for DateTime<Tz> { implementation
2074 type Value = DateTime<FixedOffset>;
2080 fn visit_str<E>(self, value: &str) -> Result<DateTime<FixedOffset>, E> in visit_str()
2095 impl<'de> de::Deserialize<'de> for DateTime<FixedOffset> { implementation
2110 impl<'de> de::Deserialize<'de> for DateTime<Utc> { implementation
2127 impl<'de> de::Deserialize<'de> for DateTime<Local> { implementation
2164 let decoded: DateTime<Utc> = deserialize(&encoded).unwrap(); in test_serde_bincode()
2172 use super::DateTime;
2310 DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:16:09 +0000"), in test_datetime_rfc2822_and_rfc3339()
2314 DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:16:09 -0000"), in test_datetime_rfc2822_and_rfc3339()
2318 DateTime::parse_from_rfc3339("2015-02-18T23:16:09Z"), in test_datetime_rfc2822_and_rfc3339()
2322 DateTime::parse_from_rfc2822("Wed, 18 Feb 2015 23:59:60 +0500"), in test_datetime_rfc2822_and_rfc3339()
2326 DateTime::parse_from_rfc3339("2015-02-18T23:59:60.234567+05:00"), in test_datetime_rfc2822_and_rfc3339()
2343 let ut = DateTime::<Utc>::from_utc(dt.naive_utc(), Utc); in test_rfc3339_opts()
2364 "2015-02-18T23:16:9.15Z".parse::<DateTime<FixedOffset>>(), in test_datetime_from_str()
2368 "2015-02-18T23:16:9.15Z".parse::<DateTime<Utc>>(), in test_datetime_from_str()
2372 "2015-02-18T23:16:9.15 UTC".parse::<DateTime<Utc>>(), in test_datetime_from_str()
2376 "2015-02-18T23:16:9.15UTC".parse::<DateTime<Utc>>(), in test_datetime_from_str()
2381 "2015-2-18T23:16:9.15Z".parse::<DateTime<FixedOffset>>(), in test_datetime_from_str()
2385 "2015-2-18T13:16:9.15-10:00".parse::<DateTime<FixedOffset>>(), in test_datetime_from_str()
2388 assert!("2015-2-18T23:16:9.15".parse::<DateTime<FixedOffset>>().is_err()); in test_datetime_from_str()
2391 "2015-2-18T23:16:9.15Z".parse::<DateTime<Utc>>(), in test_datetime_from_str()
2395 "2015-2-18T13:16:9.15-10:00".parse::<DateTime<Utc>>(), in test_datetime_from_str()
2398 assert!("2015-2-18T23:16:9.15".parse::<DateTime<Utc>>().is_err()); in test_datetime_from_str()
2407 DateTime::parse_from_str("2014-5-7T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"), in test_datetime_parse_from_str()
2410 assert!(DateTime::parse_from_str("20140507000000", "%Y%m%d%H%M%S").is_err()); // no offset in test_datetime_parse_from_str()
2411 assert!(DateTime::parse_from_str( in test_datetime_parse_from_str()
2425 let _dt: DateTime<Utc> = dt.to_string().parse().unwrap(); in test_to_string_round_trip()
2428 let _dt: DateTime<FixedOffset> = ndt_fixed.to_string().parse().unwrap(); in test_to_string_round_trip()
2431 let _dt: DateTime<FixedOffset> = ndt_fixed.to_string().parse().unwrap(); in test_to_string_round_trip()
2438 let _dt: DateTime<FixedOffset> = ndt.to_string().parse().unwrap(); in test_to_string_round_trip_with_local()
2490 assert_eq!(DateTime::<Utc>::from(UNIX_EPOCH), epoch); in test_from_system_time()
2492 DateTime::<Utc>::from(UNIX_EPOCH + Duration::new(999_999_999, nanos)), in test_from_system_time()
2496 DateTime::<Utc>::from(UNIX_EPOCH - Duration::new(999_999_999, nanos)), in test_from_system_time()
2530 assert_eq!(DateTime::<Utc>::from(UNIX_EPOCH), epoch); in test_from_system_time()
2532 DateTime::<Utc>::from(UNIX_EPOCH + Duration::new(999_999_999, nanos)), in test_from_system_time()
2536 DateTime::<Utc>::from(UNIX_EPOCH - Duration::new(999_999_999, nanos)), in test_from_system_time()