Module time/datetime
time/datetime
Wall-clock date and time in UTC.
Example
{ DateTime } :: import "std/time/datetime";
now := DateTime.now_utc();
println(now.to_string()); // "2026-02-26T17:41:24Z"
Types
DateTime
struct
DateTime
Calendar date and time with nanosecond precision.
Values are in UTC unless utc_offset_secs is non-zero.
Fields
| Name | Type | Description |
|---|---|---|
year | i32 | |
month | u8 | |
day | u8 | |
hour | u8 | |
minute | u8 | |
second | u8 | |
nanosecond | u32 | |
utc_offset_secs | i32 |
Trait Implementations
impl(DateTime, ...)
now_utc : (DateTime) fn() -> DateTimeReturns: DateTime
now : (DateTime) fn() -> DateTimeReturns: DateTime
from_unix : (DateTime) fn(secs : i64, nanos : i64) -> DateTimeto_unix : (DateTime) fn(self : *(DateTime)) -> i64is_leap_year : (DateTime) fn(self : *(DateTime)) -> boolday_of_week : (DateTime) fn(self : *(DateTime)) -> u8day_of_year : (DateTime) fn(self : *(DateTime)) -> u16impl(DateTime, ToString(...))
to_string : (fn(self: *(Self)) -> String)Returns: String