pub struct UDateFormat { /* private fields */ }
Expand description

Implements UDateFormat

Implementations§

source§

impl UDateFormat

source

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

source

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

source

pub fn set_calendar(&mut self, calendar: &UCalendar)

Implements udat_setCalendar

source

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

source

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

source

pub fn format(&self, date_to_format: UDate) -> Result<String, Error>

Formats a date using this formatter.

Implements udat_format

Trait Implementations§

source§

impl Debug for UDateFormat

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for UDateFormat

source§

fn drop(&mut self)

Implements udat_close

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.