# DateTime

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/utilities/struct-datetime/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct DateTime
```

A date and time of day with a resolution of 100 nanoseconds.

Equality, ordering and hashing consider the ticks only; the kind is ignored,
as in .NET.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L83)

## Members

- [`MIN_VALUE`](#assoc_const-min_value)
- [`MAX_VALUE`](#assoc_const-max_value)
- [`UNIX_EPOCH`](#assoc_const-unix_epoch)
- [`new`](#function-new)
- [`new_with_time`](#function-new_with_time)
- [`new_with_millisecond`](#function-new_with_millisecond)
- [`try_new`](#function-try_new)
- [`try_new_with_time`](#function-try_new_with_time)
- [`from_ticks`](#function-from_ticks)
- [`from_ticks_kind`](#function-from_ticks_kind)
- [`try_from_ticks`](#function-try_from_ticks)
- [`specify_kind`](#function-specify_kind)
- [`set_utc_now_provider`](#function-set_utc_now_provider)
- [`utc_now`](#function-utc_now)
- [`now`](#function-now)
- [`today`](#function-today)
- [`ticks`](#function-ticks)
- [`kind`](#function-kind)
- [`date`](#function-date)
- [`time_of_day`](#function-time_of_day)
- [`year`](#function-year)
- [`month`](#function-month)
- [`day`](#function-day)
- [`day_of_year`](#function-day_of_year)
- [`day_of_week`](#function-day_of_week)
- [`hour`](#function-hour)
- [`minute`](#function-minute)
- [`second`](#function-second)
- [`millisecond`](#function-millisecond)
- [`is_leap_year`](#function-is_leap_year)
- [`days_in_month`](#function-days_in_month)
- [`try_add_ticks`](#function-try_add_ticks)
- [`add_ticks`](#function-add_ticks)
- [`add`](#function-add)
- [`try_add`](#function-try_add)
- [`subtract`](#function-subtract)
- [`subtract_date_time`](#function-subtract_date_time)
- [`try_add_days`](#function-try_add_days)
- [`add_days`](#function-add_days)
- [`try_add_months`](#function-try_add_months)
- [`add_months`](#function-add_months)
- [`try_add_years`](#function-try_add_years)
- [`add_years`](#function-add_years)
- [`compare`](#function-compare)
- [`compare_to`](#function-compare_to)
- [`to_universal_time`](#function-to_universal_time)
- [`to_local_time`](#function-to_local_time)
- [`to_string_format`](#function-to_string_format)
- [`try_to_string_format`](#function-try_to_string_format)
- [`to_string_with`](#function-to_string_with)
- [`to_string_provider`](#function-to_string_provider)
- [`parse`](#function-parse)
- [`parse_with_styles`](#function-parse_with_styles)
- [`try_parse`](#function-try_parse)
- [`parse_exact`](#function-parse_exact)
- [`parse_exact_with_styles`](#function-parse_exact_with_styles)
- [`parse_exact_multiple`](#function-parse_exact_multiple)
- [`try_parse_exact`](#function-try_parse_exact)
- [`try_parse_exact_multiple`](#function-try_parse_exact_multiple)

<a id="assoc_const-min_value"></a>

### MIN_VALUE

```rust
const MIN_VALUE: DateTime
```

The smallest value, 0001-01-01T00:00:00.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L90)

<a id="assoc_const-max_value"></a>

### MAX_VALUE

```rust
const MAX_VALUE: DateTime
```

The largest value, 9999-12-31T23:59:59.9999999.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L92)

<a id="assoc_const-unix_epoch"></a>

### UNIX_EPOCH

```rust
const UNIX_EPOCH: DateTime
```

1970-01-01T00:00:00 UTC.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L94)

<a id="function-new"></a>

### new

```rust
fn new(year: i32, month: i32, day: i32) -> DateTime
```

The date `year`-`month`-`day` at midnight, of unspecified kind.
Panics when the arguments do not name a date in 0001..=9999.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L99)

<a id="function-new_with_time"></a>

### new_with_time

```rust
fn new_with_time(year: i32, month: i32, day: i32, hour: i32, minute: i32, second: i32) -> DateTime
```

The given date and time of day, of unspecified kind. Panics when the
arguments do not name a valid date and time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L106)

<a id="function-new_with_millisecond"></a>

### new_with_millisecond

```rust
fn new_with_millisecond(year: i32, month: i32, day: i32, hour: i32, minute: i32, second: i32, millisecond: i32) -> DateTime
```

The given date and time of day with milliseconds, of unspecified kind.
Panics when the arguments do not name a valid date and time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L114)

<a id="function-try_new"></a>

### try_new

```rust
fn try_new(year: i32, month: i32, day: i32) -> Option<DateTime>
```

The date `year`-`month`-`day` at midnight; `None` when the arguments
do not name a date in 0001..=9999.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L130)

<a id="function-try_new_with_time"></a>

### try_new_with_time

```rust
fn try_new_with_time(year: i32, month: i32, day: i32, hour: i32, minute: i32, second: i32) -> Option<DateTime>
```

The given date and time of day; `None` when the arguments do not name
a valid date and time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L141)

<a id="function-from_ticks"></a>

### from_ticks

```rust
const fn from_ticks(ticks: i64) -> DateTime
```

The value with the given number of ticks, of unspecified kind. Panics
when `ticks` is outside the range of the type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L155)

<a id="function-from_ticks_kind"></a>

### from_ticks_kind

```rust
const fn from_ticks_kind(ticks: i64, kind: DateTimeKind) -> DateTime
```

The value with the given number of ticks and kind. Panics when `ticks`
is outside the range of the type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L162)

<a id="function-try_from_ticks"></a>

### try_from_ticks

```rust
const fn try_from_ticks(ticks: i64, kind: DateTimeKind) -> Option<DateTime>
```

The value with the given number of ticks; `None` when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L171)

<a id="function-specify_kind"></a>

### specify_kind

```rust
const fn specify_kind(self: Self, kind: DateTimeKind) -> DateTime
```

The same ticks with another kind (.NET `DateTime.SpecifyKind`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L181)

<a id="function-set_utc_now_provider"></a>

### set_utc_now_provider

```rust
fn set_utc_now_provider(provider: Option<UtcNowProvider>) -> Option<UtcNowProvider>
```

Installs (or with `None` removes) the source of the current instant
of the current thread and returns the previous one. Tests use it to
pin `system_time_now`, `now`, `utc_now`
and `today`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L191)

<a id="function-utc_now"></a>

### utc_now

```rust
fn utc_now() -> DateTime
```

The current date and time in UTC (kind `DateTimeKind::Utc`): the
instant of `system_time_now` as a date. An instant outside of the
years 1 to 9999 is `MIN_VALUE` or
`MAX_VALUE`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L199)

<a id="function-now"></a>

### now

```rust
fn now() -> DateTime
```

The current date and time in local time (kind `DateTimeKind::Local`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L212)

<a id="function-today"></a>

### today

```rust
fn today() -> DateTime
```

The current local date at midnight (kind `DateTimeKind::Local`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L217)

<a id="function-ticks"></a>

### ticks

```rust
const fn ticks(self: Self) -> i64
```

The number of ticks since 0001-01-01T00:00:00.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L225)

<a id="function-kind"></a>

### kind

```rust
const fn kind(self: Self) -> DateTimeKind
```

The kind of time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L231)

<a id="function-date"></a>

### date

```rust
const fn date(self: Self) -> DateTime
```

The date at midnight, with the same kind.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L237)

<a id="function-time_of_day"></a>

### time_of_day

```rust
const fn time_of_day(self: Self) -> SignedDuration
```

The time elapsed since midnight.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L243)

<a id="function-year"></a>

### year

```rust
fn year(self: Self) -> i32
```

The year, 1..=9999.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L260)

<a id="function-month"></a>

### month

```rust
fn month(self: Self) -> i32
```

The month, 1..=12.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L265)

<a id="function-day"></a>

### day

```rust
fn day(self: Self) -> i32
```

The day of the month, 1..=31.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L270)

<a id="function-day_of_year"></a>

### day_of_year

```rust
fn day_of_year(self: Self) -> i32
```

The day of the year, 1..=366.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L275)

<a id="function-day_of_week"></a>

### day_of_week

```rust
fn day_of_week(self: Self) -> DayOfWeek
```

The day of the week.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L280)

<a id="function-hour"></a>

### hour

```rust
const fn hour(self: Self) -> i32
```

The hour, 0..=23.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L286)

<a id="function-minute"></a>

### minute

```rust
const fn minute(self: Self) -> i32
```

The minute, 0..=59.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L292)

<a id="function-second"></a>

### second

```rust
const fn second(self: Self) -> i32
```

The second, 0..=59.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L298)

<a id="function-millisecond"></a>

### millisecond

```rust
const fn millisecond(self: Self) -> i32
```

The millisecond, 0..=999.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L304)

<a id="function-is_leap_year"></a>

### is_leap_year

```rust
fn is_leap_year(year: i32) -> bool
```

Whether `year` (1..=9999) is a leap year. Panics for other years.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L312)

<a id="function-days_in_month"></a>

### days_in_month

```rust
fn days_in_month(year: i32, month: i32) -> i32
```

The number of days of `month` in `year`. Panics when the month is not
1..=12 or the year not 1..=9999.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L320)

<a id="function-try_add_ticks"></a>

### try_add_ticks

```rust
const fn try_add_ticks(self: Self, ticks: i64) -> Option<DateTime>
```

The value `ticks` later; `None` when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L329)

<a id="function-add_ticks"></a>

### add_ticks

```rust
fn add_ticks(self: Self, ticks: i64) -> DateTime
```

The value `ticks` later. Panics when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L338)

<a id="function-add"></a>

### add

```rust
fn add(self: Self, value: SignedDuration) -> DateTime
```

The value `value` later. Panics when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L344)

<a id="function-try_add"></a>

### try_add

```rust
fn try_add(self: Self, value: SignedDuration) -> Option<DateTime>
```

The value `value` later; `None` when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L349)

<a id="function-subtract"></a>

### subtract

```rust
fn subtract(self: Self, value: SignedDuration) -> DateTime
```

The value `value` earlier. Panics when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L355)

<a id="function-subtract_date_time"></a>

### subtract_date_time

```rust
fn subtract_date_time(self: Self, other: DateTime) -> SignedDuration
```

The interval from `other` to this value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L361)

<a id="function-try_add_days"></a>

### try_add_days

```rust
fn try_add_days(self: Self, value: f64) -> Option<DateTime>
```

The value `value` (whole and fractional) days later; `None` when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L376)

<a id="function-add_days"></a>

### add_days

```rust
fn add_days(self: Self, value: f64) -> DateTime
```

The value `value` (whole and fractional) days later. Panics when out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L382)

<a id="function-try_add_months"></a>

### try_add_months

```rust
fn try_add_months(self: Self, months: i32) -> Option<DateTime>
```

The value `months` months later (earlier when negative). The day is
kept, or becomes the last day of the resulting month when that month
is shorter. `None` when `months` is not in -120000..=120000 or the
result is out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L390)

<a id="function-add_months"></a>

### add_months

```rust
fn add_months(self: Self, months: i32) -> DateTime
```

The value `months` months later; see `try_add_months`.
Panics when `months` or the result is out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L408)

<a id="function-try_add_years"></a>

### try_add_years

```rust
fn try_add_years(self: Self, years: i32) -> Option<DateTime>
```

The value `years` years later (earlier when negative); February 29
becomes February 28 in a year that is not a leap year. `None` when
`years` is not in -10000..=10000 or the result is out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L415)

<a id="function-add_years"></a>

### add_years

```rust
fn add_years(self: Self, years: i32) -> DateTime
```

The value `years` years later; see `try_add_years`.
Panics when `years` or the result is out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L425)

<a id="function-compare"></a>

### compare

```rust
fn compare(t1: DateTime, t2: DateTime) -> i32
```

Compares two values by their ticks: negative, zero or positive
(.NET `DateTime.Compare`, which returns -1, 0 or 1).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L434)

<a id="function-compare_to"></a>

### compare_to

```rust
fn compare_to(self: Self, other: DateTime) -> i32
```

Compares this value with `other`: -1, 0 or 1.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L444)

<a id="function-to_universal_time"></a>

### to_universal_time

```rust
fn to_universal_time(self: Self) -> DateTime
```

The value converted to UTC. A value of unspecified kind is taken as
local time. A result outside the range is clamped to it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L452)

<a id="function-to_local_time"></a>

### to_local_time

```rust
fn to_local_time(self: Self) -> DateTime
```

The value converted to local time. A value of unspecified kind is
taken as UTC. A result outside the range is clamped to it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L462)

<a id="function-to_string_format"></a>

### to_string_format

```rust
fn to_string_format(self: Self, format: &str, provider: &impl DateTimeFormatProvider + ?Sized) -> String
```

Formats with a standard or custom .NET date and time format string
and the conventions of `provider` (a `CultureInfo` or a
`DateTimeFormatInfo`). An empty format is
the general format `"G"`. Panics when the format string is invalid
(.NET throws `FormatException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L478)

<a id="function-try_to_string_format"></a>

### try_to_string_format

```rust
fn try_to_string_format(self: Self, format: &str, provider: &impl DateTimeFormatProvider + ?Sized) -> Result<String, FormatError>
```

Like `to_string_format`, but gives the error
of an invalid format string.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L487)

<a id="function-to_string_with"></a>

### to_string_with

```rust
fn to_string_with(self: Self, format: &str) -> String
```

Formats with a format string and the conventions of the current
culture (.NET `ToString(string)`). Panics when the format is invalid.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L498)

<a id="function-to_string_provider"></a>

### to_string_provider

```rust
fn to_string_provider(self: Self, provider: &impl DateTimeFormatProvider + ?Sized) -> String
```

Formats with the general format `"G"` and the conventions of
`provider` (.NET `ToString(IFormatProvider)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L504)

<a id="function-parse"></a>

### parse

```rust
fn parse(text: &str, provider: &impl DateTimeFormatProvider + ?Sized) -> Result<DateTime, FormatError>
```

Parses a date and time written in the conventions of `provider`
(.NET `DateTime.Parse(string, IFormatProvider)`).

This is not the heuristic parser of .NET. It is checked against
results recorded from .NET (`date_time_net_data.rs`, tables `PARSE`,
`PARSE_ROUND_TRIP` and `PARSE_STYLES`) for the invariant culture,
`en`, `en-US` and `en-GB`, which covers what the date picker feeds
it: the text it writes itself with the short and the long date
pattern of the culture, and typed dates of these forms:

* numeric dates with `/`, `-`, `.` or spaces in the order of the
  short date pattern; a year of three or more digits written first
  gives year-month-day; two-digit years are 1950..=2049;
* month names and abbreviations (of the culture or English), with
  the day before or after and an optional, matching day name;
* a month and a year alone (the first of the month), a month and a
  day alone (the current year);
* an offset from UTC (`Z`, `GMT`, a signed `hh:mm`, `hhmm` or `h[h]`)
  after the time or after a date without a time; the result is then
  the local time of that instant;
* ISO 8601 `yyyy-MM-ddTHH:mm:ss[.fffffff]` with `Z` or an offset,
  the sortable, universal sortable and RFC 1123 formats;
* a time `H:mm[:ss[.fffffff]]` with an optional designator before or
  after the date, or alone (the current date).

Everything else is rejected, and has not been compared with .NET
beyond the recorded rows: other time zone names than `GMT`
and `Z` (.NET rejects `UTC` too), era names, and a two-number date that is only valid in the
order the culture does not use. The genitive month names of a culture
that has them (`DateTimeFormatInfo::month_genitive_names`) are read
beside the plain ones, as in .NET.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L567)

<a id="function-parse_with_styles"></a>

### parse_with_styles

```rust
fn parse_with_styles(text: &str, provider: &impl DateTimeFormatProvider + ?Sized, styles: DateTimeStyles) -> Result<DateTime, FormatError>
```

Parses a date and time written in the conventions of `provider`
(.NET `DateTime.Parse(string, IFormatProvider, DateTimeStyles)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L573)

<a id="function-try_parse"></a>

### try_parse

```rust
fn try_parse(text: &str, provider: &impl DateTimeFormatProvider + ?Sized, styles: DateTimeStyles) -> Option<DateTime>
```

Parses like `parse_with_styles`; `None` on failure
(.NET `DateTime.TryParse`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L584)

<a id="function-parse_exact"></a>

### parse_exact

```rust
fn parse_exact(text: &str, format: &str, provider: &impl DateTimeFormatProvider + ?Sized) -> Result<DateTime, FormatError>
```

Parses a date and time that has to match `format` exactly
(.NET `DateTime.ParseExact(string, string, IFormatProvider)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L594)

<a id="function-parse_exact_with_styles"></a>

### parse_exact_with_styles

```rust
fn parse_exact_with_styles(text: &str, format: &str, provider: &impl DateTimeFormatProvider + ?Sized, styles: DateTimeStyles) -> Result<DateTime, FormatError>
```

Parses a date and time that has to match `format` exactly
(.NET `DateTime.ParseExact(string, string, IFormatProvider, DateTimeStyles)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L604)

<a id="function-parse_exact_multiple"></a>

### parse_exact_multiple

```rust
fn parse_exact_multiple(text: &str, formats: &[&str], provider: &impl DateTimeFormatProvider + ?Sized, styles: DateTimeStyles) -> Result<DateTime, FormatError>
```

Parses a date and time that has to match one of `formats` exactly; the
first format that matches wins (.NET `DateTime.ParseExact(string, string[], ..)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L616)

<a id="function-try_parse_exact"></a>

### try_parse_exact

```rust
fn try_parse_exact(text: &str, format: &str, provider: &impl DateTimeFormatProvider + ?Sized, styles: DateTimeStyles) -> Option<DateTime>
```

Like `parse_exact_with_styles`; `None` on failure
(.NET `DateTime.TryParseExact(string, string, ..)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L635)

<a id="function-try_parse_exact_multiple"></a>

### try_parse_exact_multiple

```rust
fn try_parse_exact_multiple(text: &str, formats: &[&str], provider: &impl DateTimeFormatProvider + ?Sized, styles: DateTimeStyles) -> Option<DateTime>
```

Like `parse_exact_multiple`; `None` on failure
(.NET `DateTime.TryParseExact(string, string[], ..)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/date_time.rs#L646)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Copy`
- `Default`
- `PartialEq`
- `Eq`
- `PartialOrd`
- `Ord`
- `Hash`
- `Add<SignedDuration>`
- `Sub<SignedDuration>`
- `Sub`
- `AddAssign<SignedDuration>`
- `SubAssign<SignedDuration>`
- `Display`
- `Debug`
- `FromStr`
- `TryFrom<SystemTime>`
- `TryFrom<DateTime>`
- `From<DateTime>`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
