Function icu_datetime::mock::parse_zoned_gregorian_from_str
source · [−]pub fn parse_zoned_gregorian_from_str(
input: &str
) -> Result<(DateTime<Gregorian>, CustomTimeZone), Either<DateTimeError, TimeZoneError>>
Expand description
Parse a DateTime
and CustomTimeZone
from a string.
This utility is for easily creating dates, not a complete robust solution. The
string must take a specific form of the ISO 8601 format:
YYYY-MM-DDThh:mm:ssZ
,
YYYY-MM-DDThh:mm:ss±hh
,
YYYY-MM-DDThh:mm:ss±hhmm
,
YYYY-MM-DDThh:mm:ss±hh:mm
,
Examples
use icu::datetime::mock;
let (date, zone) = mock::parse_zoned_gregorian_from_str("2020-10-14T13:21:00+05:30")
.expect("Failed to parse a zoned datetime.");