Skip to main content

Crate datetime

Crate datetime 

Source

Re-exports§

pub use cron::Cron;
pub use cron::CronError;
pub use tz::LocalResult;
pub use tz::Zone;

Modules§

cron
tz

Structs§

Civil
a calendar date and wall time without a zone
Timestamp
a point in time: seconds since 1970-01-01 00:00:00 UTC and nanoseconds

Functions§

civil_from_days
(year, month, day) of days since 1970-01-01
days_from_civil
days since 1970-01-01 of a date (proleptic Gregorian; Howard Hinnant’s algorithm)
days_in_month
days of month m (1..12)
format_date
“12.10.2026” / “2026-10-12”
format_date_time
“12.10.2026 19:58” (de) / “2026-10-12 19:58” (en) in a zone
format_duration
a duration for people: “42 s”, “3 min 05 s”, “1 h 12 min”, “2 d 3 h”
format_relative
a relative time for people: “vor 5 min” / “5 min ago”, “in 2 h” (now and then in seconds)
format_time
“19:58”
is_leap
parse_rfc3339
parse YYYY-MM-DDTHH:MM:SS[.fff…](Z|±HH:MM) (also with a space or lower-case t / z)
rfc3339
“2026-10-12T19:58:00Z” (with “.123” milliseconds when the timestamp has them)
rfc3339_offset
the timestamp as local time with its UTC offset: “2026-10-12T21:58:00+02:00”
weekday
weekday of a date: 0 = Monday .. 6 = Sunday