Date
The date crate provides a simple, easy-to-use Date struct (and corresponding macro). Date
provides storage for a single Gregorian calendar date.
Date can currently represent any valid calendar date between years -32,768 and 32,767.
Examples
Making a date:
use Date;
let date = new;
You can also use the date! macro to get a syntax resembling a date literal:
use date;
let date = date! ;
Overflow
Date provides an overflowing_new function that allows for overflow values (for example,
February 30 or December 32), and maps them accordingly. This allows users to perform certain
mathematical computations without having to do their own overflow checking.
Features
date-rs ships with the following features:
diesel-pg: Enables interop with PostgreSQLDATEcolumns using Diesel.duckdb: Enables interop withduckdbcrate.easter: Enables calculation for the date of Easter (Gregorian calenda).log: Addslog::kv::ToValueimplementation.serde: Enables serialization and desearialization withserde. (Enabled by default.)tz: Enables support for time-zone-aware date construction.