🕐
pai Core Libraries
datetime-utils
Date and time operations for PascalAI. Get the current time, format and parse date strings, compute differences, and check calendar properties.
Install ppm install datetime-utils
Usage Example
uses datetime_utils; // Current date/time var today := Now; var todayStr := FormatDate(today, 'YYYY-MM-DD'); // '2026-03-12' var fullStr := FormatDate(today, 'DD/MM/YYYY HH:MM'); // Parse a date string var d := ParseDate('2026-01-01', 'YYYY-MM-DD'); // Arithmetic var nextWeek := AddDays(today, 7); var diff := DiffDays(today, d); // days since Jan 1 // Calendar checks if IsWeekend(today) then WriteLn('Weekend!'); // Unix timestamp var ts := ToUnixTime(today);
Features
Now: get current local date and time
FormatDate: format a date with a custom format string
ParseDate: parse a string into a date value
AddDays, AddMonths, AddYears: date arithmetic
DiffDays: compute the difference between two dates
IsWeekend, IsLeapYear: calendar predicates
ToUnixTime / FromUnixTime: Unix timestamp conversion
← Back to Package Index