You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
conststd=@import("std");
constdatetime=@import("datetime");
test"now" {
constdate=datetime.Date.now();
std.debug.print("today's date is {rfc3339}\n", .{ date });
consttime=datetime.Time.now();
std.debug.print("today's time is {rfc3339}\n", .{ time });
constnanotime=datetime.time.Nano.now();
std.debug.print("today's nanotime is {rfc3339}\n", .{ nanotime });
constdt=datetime.DateTime.now();
std.debug.print("today's date and time is {rfc3339}\n", .{ dt });
constNanoDateTime=datetime.datetime.Advanced(datetime.Date, datetime.time.Nano, false);
constndt=NanoDateTime.now();
std.debug.print("today's date and nanotime is {rfc3339}\n", .{ ndt });
}
Features:
Convert to/from epoch subseconds using world's fastest known algorithm. 1
Choose your precision:
Date's Year type.
Time's Subsecond type.
Date's epoch for subsecond conversion.
Whether DateTime has an OffsetSeconds field
Durations with addition.
RFC3339 parsing and formatting.
Use Comptime dates for epoch math.
In-scope, PRs welcome:
Localization
Leap seconds
Why yet another date time library?
I frequently use different precisions for years, subseconds, and UTC offsets.