Category | Functions |
---|---|
Main date types | Date DateTime |
Other date types | Month DayOfWeek TimeOfDay |
Date checking | valid validTimeUnits yearIsLeapYear isTimePoint enforceValid |
Date conversion | daysToDayOfWeek monthsToMonth |
Time units | cmpTimeUnits timeStrings |
Other | AllowDayOverflow DateTimeException |
In some date calculations, adding months or years can cause the date to fall on a day of the month which is not valid (e.g. February 29th 2001 or June 31st 2000). If overflow is allowed (as is the default), then the month will be incremented accordingly (so, February 29th 2001 would become March 1st 2001, and June 31st 2000 would become July 1st 2000). If overflow is not allowed, then the day will be adjusted to the last valid day in that month (so, February 29th 2001 would become February 28th 2001 and June 31st 2000 would become June 30th 2000).
Exception type used by std.datetime. It's an alias to core.time.TimeException. Either can be caught without concern about which module it came from.
Represents the 7 days of the Gregorian week (Sunday is 0).
Represents the 12 months of the Gregorian year (January is 1).
Compares two time unit strings. "years" are the largest units and "hnsecs" are the smallest.
Returns the number of days from the current day of the week to the given day of the week. If they are the same, then the result is 0.
Because the validity of the day number depends on both on the year and month of which the day is occurring, take all three variables to validate the day.
Returns the number of months from the current months of the year to the given month of the year. If they are the same, then the result is 0.
Returns whether the given value is valid for the given unit type when in a time point. Naturally, a duration is not held to a particular range, but the values in a time point are (e.g. a month must be in the range of 1 - 12 inclusive).
Returns whether the given day is valid for the given year and month.
Whether all of the given strings are valid units of time.
Whether the given Gregorian Year is a leap year.
Represents a date in the Proleptic Gregorian Calendar ranging from 32,768 B.C. to 32,767 A.D. Positive years are A.D. Non-positive years are B.C.
Combines the std.datetime.date.Date and std.datetime.date.TimeOfDay structs to give an object which holds both the date and the time. It is optimized for calendar-based operations and has no concept of time zone. For an object which is optimized for time operations based on the system time, use std.datetime.systime.SysTime. std.datetime.systime.SysTime has a concept of time zone and has much higher precision (hnsecs). DateTime is intended primarily for calendar-based uses rather than precise time operations.
Represents a time of day with hours, minutes, and seconds. It uses 24 hour time.
Compares two time unit strings at compile time. "years" are the largest units and "hnsecs" are the smallest.
Whether the given type defines all of the necessary functions for it to function as a time point.
Array of the strings representing time units, starting with the smallest unit and going to the largest. It does not include "nsecs".