logos.std.time.datetime
Module std · package logos-std
Types
structCivilTime
struct CivilTime
Broken-down UTC civil time in the proleptic Gregorian calendar.
Fields
day: i32
Day of month, 1..=31.
hour: i32
Hour of day, 0..=23.
minute: i32
Minute of hour, 0..=59.
month: i32
Month of year, 1..=12.
second: i32
Second of minute, 0..=59; leap seconds are not represented.
wday: i32
Day of week, 0 = Sunday through 6 = Saturday.
year: i64
Proleptic-Gregorian year; may be negative.
Functions
fndays_in_month
fn days_in_month(y: i64, m: i32) -> i32
Returns the number of days in month m of year y, or 0 if m is outside 1..=12.
fnformat_date
fn format_date(ct: &CivilTime, out: &mut String) -> void
Appends the date of ct to out as YYYY-MM-DD (leading - for negative years).
fnformat_iso8601
fn format_iso8601(ct: &CivilTime, out: &mut String) -> void
Appends ct to out as ISO-8601 YYYY-MM-DDTHH:MM:SSZ (UTC).
Negative years are written with a leading -; the year is zero-padded to 4 digits.
fnformat_time
fn format_time(ct: &CivilTime, out: &mut String) -> void
Appends the time of day of ct to out as HH:MM:SS.
fnfrom_unix_secs
fn from_unix_secs(secs: i64) -> CivilTime
Breaks a Unix-epoch second count into UTC civil time, including wday.
fnis_leap
fn is_leap(y: i64) -> bool
Returns true if year y is a leap year in the proleptic Gregorian calendar.
fnmonth_name
fn month_name(m: i32) -> &[u8]
Returns the full English month name for m in 1..=12, or "" otherwise.
fnto_unix_secs
fn to_unix_secs(ct: &CivilTime) -> i64
Converts a CivilTime (UTC) back to Unix seconds.
wday is ignored; fields are not range-checked.
fnweekday_name
fn weekday_name(w: i32) -> &[u8]
Returns the full English weekday name for w (0 = "Sunday" … 6 = "Saturday"), or "".