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, implicitly enables
This enables a number of features that depend on the standard library.
alloc(enabled by default via
Enables a number of features that require the ability to dynamically allocate memory.
Enables macros that provide compile-time verification of values and intuitive syntax.
Enables formatting of most structs.
Enables parsing of most structs.
This feature enables a number of methods that allow obtaining the system’s UTC offset.
By default, only years within the ±9999 range (inclusive) are supported. If you need support for years outside this range, consider enabling this feature; the supported range will be increased to ±999,999.
Note that enabling this feature has some costs, as it means forgoing some optimizations. Ambiguities may be introduced when parsing that would not otherwise exist.
Allows serde representations to use a human-readable format. This is determined by the serializer, not the user. If this feature is not enabled or if the serializer requests a non-human-readable format, a format optimized for binary representation will be used.
Libraries should never enable this feature, as the decision of what format to use should be up to the user.
This feature flag is deprecated and will be removed in a future breaking release. Use the
Enables support for serializing and deserializing well-known formats using serde’s
Enables rand support for all types.
pub use crate::date::Date;
pub use crate::duration::Duration;
pub use crate::error::Error;
pub use crate::instant::Instant;
pub use crate::month::Month;
pub use crate::offset_date_time::OffsetDateTime;
pub use crate::primitive_date_time::PrimitiveDateTime;
pub use crate::time::Time;
pub use crate::utc_offset::UtcOffset;
pub use crate::weekday::Weekday;
- Conversion between units of time.
- date 🔒The
Datestruct and its associated
DateTimestruct and its associated
- duration 🔒The
Durationstruct and its associated
- Various error types returned by methods in the time crate.
- Extension traits.
parsingDescription of how types should be formatted and parsed.
formattingFormatting for various types.
- instant 🔒
Instantstruct and its associated
- Macros for use within the library. They are not publicly available.
macrosMacros to construct statically known values.
- month 🔒The
Monthenum and its associated
OffsetDateTimestruct and its associated
parsingParsing for various types.
PrimitiveDateTimestruct and its associated
- quickcheck 🔒
quickcheckImplementations of the
- rand 🔒
Distributionfor various structs.
serdeDifferential formats for serde.
- sys 🔒Functions with a common interface that rely on system calls.
- time 🔒The
Timestruct and its associated
UtcOffsetstruct and its associated
- Utility functions.
- weekday 🔒Days of the week.
- This is a separate function to reduce the code size of
- An alias for
std::result::Resultwith a generic error from the time crate.