datefmt

datefmt provides parsing and formatting for std.datetime objects.

The format is taken from strftime: %a The abbreviated name of the day of the week. %A The full name of the day of the week. %b The abbreviated month name. %B The full month name. %C The century number (year/100) as a 2-digit integer. %d The day of the month as a decimal number (range 01 to 31). %e Like %d, the day of the month as a decimal number, but space padded. %F Equivalent to %Y-%m-%d (the ISO 8601 date format). %h The hour as a decimal number using a 12-hour clock (range 01 to 12). %H The hour as a decimal number using a 24-hour clock (range 00 to 23). %I The hour as a decimal number using a 12-hour clock (range 00 to 23). %j The day of the year as a decimal number (range 001 to 366). %k The hour (24-hour clock) as a decimal number (range 0 to 23), space padded. %l The hour (12-hour clock) as a decimal number (range 1 to 12), space padded. %m The month as a decimal number (range 01 to 12). %M The minute as a decimal number (range 00 to 59). %p "AM" / "PM" (midnight is AM; noon is PM). %P "am" / "pm" (midnight is AM; noon is PM). %r Equivalent to "%I:%M:%S %p". %R Equivalent to "%H:%M". %s The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). %S The second as a decimal number (range 00 to 60). %T Equivalent to "%H:%M:%S". %u The day of the week as a decimal, range 1 to 7, Monday being 1 (formatting only). %V The ISO 8601 week number (formatting only). %w The day of the week as a decimal, range 0 to 6, Sunday being 0 (formatting only). %y The year as a decimal number without a century (range 00 to 99). %Y The year as a decimal number including the century, minimum 4 digits. %z The +hhmm or -hhmm numeric timezone (that is, the hour and minute offset from UTC). %Z The timezone name or abbreviation. Formatting only. %% A literal '%' character.

Members

Aliases

to
alias to = std.conv.to
Undocumented in source.

Functions

format
string format(SysTime dt, string formatString)

Format the given datetime with the given format string.

parse
SysTime parse(string data, string formatString, immutable(TimeZone) defaultTimeZone, bool allowTrailingData)

Parse the given datetime string with the given format string.

parseRFC1123
SysTime parseRFC1123(string data, bool allowTrailingData)

Parse an RFC1123 date.

toRFC1123
string toRFC1123(SysTime date)

Produce an RFC1123 date string from a SysTime.

tryParse
bool tryParse(string data, string formatString, SysTime dt, immutable(TimeZone) defaultTimeZone)

Try to parse the input string according to the given pattern.

Manifest constants

RFC1123FORMAT
enum RFC1123FORMAT;
Undocumented in source.

Meta