Expand description
Core datetime functionality and operations.
This module contains the primary DateTime type and associated functionality
for date and time manipulation.
DateTime module for managing dates, times, and timezones in Rust.
§Overview
This module provides a comprehensive datetime manipulation API that includes:
- Fixed offset timezone support
- Date and time creation and parsing
- Format conversion (RFC 3339, ISO 8601)
- Date arithmetic and comparison operations
- Validation utilities
Note: Daylight Saving Time (DST) is not automatically handled. Users must manually manage DST transitions by selecting appropriate timezone offsets.
§Examples
use dtt::datetime::DateTime;
// Create current UTC time
let now = DateTime::new();
// Parse specific datetime
let maybe_dt = DateTime::parse("2024-01-01T12:00:00Z");
if let Ok(dt) = maybe_dt {
// Convert timezone
let est = dt.convert_to_tz("EST");
if let Ok(est_dt) = est {
// ...
}
}Structs§
- Date
Time - Represents a date and time with timezone offset support.
- Date
Time Builder - A builder for
DateTimeobjects, allowing more ergonomic creation of datetimes with customized year, month, day, hour, minute, second, and offset.
Functions§
- days_
in_ month - Helper function to determine the number of days in a given month and year.
- is_
leap_ year - Helper function to determine if a year is a leap year.