std.date

Undocumented in source.

Members

Aliases

DosFileTime
alias DosFileTime = uint

Type representing the DOS file date/time format.

d_time
alias d_time = long

d_time is a signed arithmetic type giving the time elapsed since January 1, 1970. Negative values are for dates preceding 1970. The time unit used is Ticks. Ticks are milliseconds or smaller intervals.

toString
deprecated alias toString = UTCtoString

Alias for UTCtoString (deprecated).

Functions

UTCtoLocalTime
d_time UTCtoLocalTime(d_time t)

Convert from UTC to local time.

UTCtoString
string UTCtoString(d_time time)

Converts UTC time into a text string of the form: "Www Mmm dd hh:mm:ss GMT+-TZ yyyy". For example, "Tue Apr 02 02:04:57 GMT-0800 1996". If time is invalid, i.e. is d_time_nan, the string "Invalid date" is returned.

benchmark
ulong[] benchmark(uint times, ulong[] result)

Benchmarks code for speed assessment and comparison.

dateFromNthWeekdayOfMonth
int dateFromNthWeekdayOfMonth(int year, int month, int weekday, int n)

Determine the date in the month, 1..31, of the nth weekday.

dateFromTime
int dateFromTime(d_time t)

Compute which day in a month a d_time t is.

dayFromYear
int dayFromYear(int year)

Calculates the number of days elapsed since 1 January 1970 until 1 January of the given year.

daysInMonth
int daysInMonth(int year, int month)

Determine the number of days in a month, 1..31.

daysInYear
uint daysInYear(uint year)

Calculates the number of days that exists in a year.

getUTCtime
d_time getUTCtime()

Get current UTC time.

getUTCtime
d_time getUTCtime()

Get current UTC time.

hourFromTime
int hourFromTime(d_time time)

Calculates the hour from time.

inLeapYear
bool inLeapYear(d_time t)

Determines if d_time t is a leap year.

localTimetoUTC
d_time localTimetoUTC(d_time t)

Convert from local time to UTC.

minFromTime
int minFromTime(d_time time)

Calculates the minute from time.

monthFromTime
int monthFromTime(d_time t)

Calculates the month from the d_time t.

msFromTime
int msFromTime(d_time time)

Calculates the milisecond from time.

parse
d_time parse(string s)

Parses s as a textual date string, and returns it as a d_time. If the string is not a valid date, d_time_nan is returned.

secFromTime
int secFromTime(d_time time)

Calculates the second from time.

toDateString
string toDateString(d_time time)

Converts the date portion of time into a text string of the form: "Www Mmm dd yyyy", for example, "Tue Apr 02 1996". If time is invalid, "Invalid date" is returned.

toDosFileTime
DosFileTime toDosFileTime(d_time t)

Convert from d_time to DOS file date/time.

toDtime
d_time toDtime(DosFileTime time)

Convert from DOS file date/time to d_time.

toISO8601YearWeek
void toISO8601YearWeek(d_time t, int year, int week)

Compute year and week [1..53] from t. The ISO 8601 week 1 is the first week of the year that includes January 4. Monday is the first day of the week. References: ISO 8601 (Wikipedia)

toTimeString
string toTimeString(d_time time)

Converts the time portion of t into a text string of the form: "hh:mm:ss GMT+-TZ", for example, "02:04:57 GMT-0800". If t is invalid, "Invalid date" is returned. The input must be in UTC, and the output is in local time.

toUTCString
string toUTCString(d_time t)

Converts t into a text string of the form: "Www, dd Mmm yyyy hh:mm:ss UTC". If t is invalid, "Invalid date" is returned.

weekDay
int weekDay(d_time t)

Compute which day of the week a d_time t is.

yearFromTime
int yearFromTime(d_time t)

Calculates the year from the d_time t.

Structs

Date
struct Date

Time broken down into its components.

Variables

d_time_nan
enum d_time d_time_nan;

A value for d_time that does not represent a valid time.

Suggestion Box / Bug Report