Type Alias icu_datetime::fieldset::YMDTV
source · pub type YMDTV = Combo<YMDT, Vs>;
Expand description
“17 May 2024, 15:47:50 GMT” ⇒ 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::YMDTV;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
let fmt = DateTimeFormatter::<YMDTV>::try_new(
&locale!("en-GB").into(),
YMDTV::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"
);
In FixedCalendarDateTimeFormatter
:
use icu::calendar::{Date, Time};
use icu::timezone::{TimeZoneInfo, IxdtfParser};
use icu::calendar::Gregorian;
use icu::datetime::FixedCalendarDateTimeFormatter;
use icu::datetime::fieldset::YMDTV;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
let fmt = FixedCalendarDateTimeFormatter::<Gregorian, YMDTV>::try_new(
&locale!("en-GB").into(),
YMDTV::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"
);
Aliased Type§
struct YMDTV { /* private fields */ }