pub struct UDateFormat { /* private fields */ }
Expand description
Implements UDateFormat
Implementations§
Source§impl UDateFormat
impl UDateFormat
Sourcepub fn new_with_styles(
time_style: UDateFormatStyle,
date_style: UDateFormatStyle,
loc: &ULoc,
tz_id: &UChar,
) -> Result<Self, Error>
pub fn new_with_styles( time_style: UDateFormatStyle, date_style: UDateFormatStyle, loc: &ULoc, tz_id: &UChar, ) -> Result<Self, Error>
Creates a new UDateFormat
based on the provided styles.
Neither time_style nor date_style may be UDAT_PATTERN
. If you need
formatting with a pattern, use instead new_with_pattern
.
Implements udat_open
Sourcepub fn new_with_pattern(
loc: &ULoc,
tz_id: &UChar,
pattern: &UChar,
) -> Result<Self, Error>
pub fn new_with_pattern( loc: &ULoc, tz_id: &UChar, pattern: &UChar, ) -> Result<Self, Error>
Creates a new UDateFormat
based on the provided pattern.
One example pattern is: “yyyy-MM-dd’T’HH:mm:ssXX”.
Implements udat_open
Sourcepub fn set_calendar(&mut self, calendar: &UCalendar)
pub fn set_calendar(&mut self, calendar: &UCalendar)
Implements udat_setCalendar
Sourcepub fn parse(&self, datetime: &str) -> Result<UDate, Error>
pub fn parse(&self, datetime: &str) -> Result<UDate, Error>
Parses a date-time given as a string into a sys::UDate
timestamp.
This version of date parsing does not allow reuse of the input parameters so it is less
useful for purposes that are not one-shot. See somewhat more detailed parse_from_position
instead.
Implements udat_parse
Sourcepub fn parse_from_position(
&self,
datetime: &UChar,
position: usize,
) -> Result<Parsed, Error>
pub fn parse_from_position( &self, datetime: &UChar, position: usize, ) -> Result<Parsed, Error>
Parses a date-time given as a string into a sys::UDate
timestamp and a position
indicating the first index into datetime
that was not consumed in parsing. The
position
parameter indicates the index into datetime
that parsing should start from.
Implements udat_parse