DATE is a collection of date and time functions. Call them directly on the object name, as in DATE.GetNow().
Times are passed as .NET Ticks values (long). One tick is 100 nanoseconds (1 second = 10,000,000 ticks), counted from 0001-01-01 00:00, so two times can be compared directly with < and >. Use ConvertDateTimeString to turn a value into a human-readable string.
long now = DATE.GetNow(); // current time ( PC local time )string day = DATE.ConvertDateString(now); // "2026-05-06"string text = DATE.ConvertDateTimeString(now); // "2026-05-06 09:30:00"string file = DATE.ConvertDateTimeString(now, "yyyyMMdd_HHmmss"); // "20260506_093000"Log("now = {0}", text);
Pass a variable to a parameter marked &. When the call returns, the result is stored in that variable; passing a value or an expression is a build error (a /*ref*/ comment at the call site is recommended — see Functions).
Returns a string built with format (e.g. "yyyyMMdd_HHmmss" → 20260506_093000). See the Notes section below for format characters.
long ConvertDateTimeLong(string date)
Converts a date/time string to ticks. If the string has a time zone such as Z or +09:00, the result is converted to PC local time. A string that cannot be read raises a runtime error.
long ConvertUtcDateTimeLong(string date)
Converts a date/time string to UTC ticks. Without a time zone, the string is taken as PC local time and converted to UTC (on a PC set to Korea time, "2026-05-06 09:30:00" → 00:30 UTC). With Z, the time is used as is. A string that cannot be read raises a runtime error.
bool TryParseDateTime(string dateStr, long &dateTicks)
Returns true and stores the ticks in dateTicks if the string can be read. Otherwise returns false and sets the variable to 0. Never raises a runtime error.
Ticks carry no time zone.GetNow() returns local time and GetUtcNow() returns UTC; the script must keep track of which is which. ConvertDateTimeString prints the value as it is.
Format characters — .NET date format strings are used: yyyy year · MM month · dd day · HH hour (24-hour) · mm minute · ss second · fff millisecond. They are case-sensitive (MM month / mm minute). Day and month names (ddd, MMM, etc.) appear in the language of the PC's regional settings.
Reading strings — ConvertDateTimeLong and TryParseDateTime read strings according to the PC's regional settings. Prefer the yyyy-MM-dd HH:mm:ss format over formats such as 05/06/2026, whose month/day order differs by region. A string produced by ConvertDateTimeString can be read back as is.
Functions that raise a runtime error — ConvertDateTimeLong and ConvertUtcDateTimeLong (string that cannot be read), EncodeDate and EncodeDateTime (non-existent date or out-of-range value). A runtime error stops execution at that point. Check strings that come from outside with TryParseDateTime first.
Function names are case-sensitive — note MilliSecondsBetween (capital S) versus IncrementMilliseconds (lowercase s). A call to an unknown name or with the wrong number of arguments is reported as a build error (Compile diagnostics).
There is no function that adds weeks. Use DATE.IncrementDays(t, 7 * n).