Type Alias icu::datetime::fieldsets::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

In DateTimeFormatter:

use icu::calendar::{Date, Time};
use icu::timezone::{TimeZoneInfo, IxdtfParser};
use icu::datetime::DateTimeFormatter;
use icu::datetime::fieldsets::YMDTV;
use icu::locale::locale;
use writeable::assert_writeable_eq;

let fmt = DateTimeFormatter::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_writeable_eq!(
    fmt.format_any_calendar(&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::fieldsets::YMDTV;
use icu::locale::locale;
use writeable::assert_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_writeable_eq!(
    fmt.format(&dtz),
    "17 May 2024, 15:47:50 GMT"
);

Aliased Type§

struct YMDTV { /* private fields */ }