pub fn days_since_epoch_to_date(days: u64) -> (u32, u32, u32)Expand description
Convert days since Unix epoch to (year, month, day)
This is a common utility used for date calculations in monitoring and storage. The implementation handles leap years correctly and returns 1-indexed days.
§Arguments
days- Number of days since Unix epoch (1970-01-01)
§Returns
A tuple of (year, month, day) where:
- year: Full year (e.g., 2023)
- month: Month (1-12)
- day: Day of month (1-31)
§Examples
use rusty_common::time::days_since_epoch_to_date;
// Convert 0 days (Unix epoch)
let (year, month, day) = days_since_epoch_to_date(0);
assert_eq!((year, month, day), (1970, 1, 1));
// Convert 365 days (1971-01-01)
let (year, month, day) = days_since_epoch_to_date(365);
assert_eq!((year, month, day), (1971, 1, 1));