This crate exposes a number of features. These can be enabled or disabled as shown in Cargo’s documentation. Features are disabled by default unless otherwise noted.
Reliance on a given feature is always indicated alongside the item definition.
std(enabled by default)
This crate currently requires a global allocator be present even if this feature is disabled.
Enables serde support for all types.
Enables rand support for all types.
deprecated(enabled by default)
Allows using certain deprecated functions from time 0.1.
Non-panicking APIs are provided, and should generally be preferred. However, there are some situations where avoiding
.unwrap()may be desired. Generally speaking, macros should be used in these situations. Library authors should avoid using this feature.
Time’s formatting behavior is based on
strftime in C, though it is
explicitly not compatible. Specifiers may be missing, added, or have
different behavior than in C. As such, you should use the table below, which
is an up-to-date reference on what each specifier does.
|Abbreviated weekday name|
|Full weekday name|
|Abbreviated month name|
|Full month name|
|Date and time representation, equivalent to |
|Year divided by 100 and truncated to integer (|
|Day of the month, zero-padded (|
|Short MM/DD/YY date, equivalent to |
|Short YYYY-MM-DD date, equivalent to |
|Week-based year, last two digits (|
|Hour in 24h format (|
|Hour in 12h format (|
|Day of the year (|
|Month as a decimal number (|
|Subsecond nanoseconds. Always 9 digits|
|12-hour clock time, equivalent to |
|24-hour HH:MM time, equivalent to |
|24-hour clock time with seconds, equivalent to |
|ISO 8601 weekday as number with Monday as 1 (|
|Week number with the first Sunday as the start of week one (|
|ISO 8601 week number (|
|Weekday as a decimal number with Sunday as 0 (|
|Week number with the first Monday as the start of week one (|
|Year, last two digits (|
|Full year, including |
|ISO 8601 offset from UTC in timezone (+HHMM)|
All specifiers that are strictly numerical have modifiers for formatting. Adding a modifier to a non-supporting specifier is a no-op.
|Pad with spaces|
|Pad with zeros|
Various error types returned by methods in the time crate.
Macros to statically construct values that are known to be valid.
A collection of imports that are widely useful.
Differential formats for serde.
A span of time with nanosecond precision.
A measurement of a monotonically non-decreasing clock. Opaque and useful
Combined date and time.
The clock time within a given date. Nanosecond precision.
An offset from UTC.
Various well-known formats, along with the possibility for a custom format (provided either at compile-time or runtime).
An error occurred while parsing.
Contains the sign of a value: positive, negative, or zero.
Days of the week.
Parse any parsable type from the time crate.
An alias for