Type Alias icu_datetime::fieldset::YMDTO
source · pub type YMDTO = Combo<YMDT, O>;
Expand description
“17 May 2024, 15:47:50 GMT+1” ⇒ locale-dependent date and time fields with a time zone
§Examples
use icu::calendar::{Date, Time};
use icu::timezone::{TimeZoneInfo, IxdtfParser};
use icu::datetime::DateTimeFormatter;
use icu::datetime::fieldset::YMDTO;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
let fmt = DateTimeFormatter::<YMDTO>::try_new(
&locale!("en-GB").into(),
YMDTO::medium(),
)
.unwrap();
let mut dtz = IxdtfParser::new().try_from_str("2024-05-17T15:47:50+01:00[Europe/London]").unwrap();
assert_try_writeable_eq!(
fmt.convert_and_format(&dtz),
"17 May 2024, 15:47:50 GMT+1"
);
In FixedCalendarDateTimeFormatter
:
use icu::calendar::{Date, Time};
use icu::timezone::{TimeZoneInfo, IxdtfParser};
use icu::calendar::Gregorian;
use icu::datetime::FixedCalendarDateTimeFormatter;
use icu::datetime::fieldset::YMDTO;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
let fmt = FixedCalendarDateTimeFormatter::<Gregorian, YMDTO>::try_new(
&locale!("en-GB").into(),
YMDTO::medium(),
)
.unwrap();
let mut dtz = IxdtfParser::new().try_from_str("2024-05-17T15:47:50+01:00[Europe/London]")
.unwrap()
.to_calendar(Gregorian);
assert_try_writeable_eq!(
fmt.format(&dtz),
"17 May 2024, 15:47:50 GMT+1"
);
Aliased Type§
struct YMDTO { /* private fields */ }