StrToDateTime

Qubes 5.6 Converts a string to a date/time in a user-defined format.

Syntax

StrToDateTime(format, string)
format = string specifying the format to use (see below)
string = string you want to convert to a date

Remarks

StrToDateTime is the inverse function of FormatDateTime.

format must correspond to the format of the string, otherwise the function will return "#VAL!".

The format string can contain the following specifiers:

SpecifierDisplay
dDisplays the day number without a zero prefix (from 1 to 31).
ddDisplays the day number with a zero prefix (from 01 to 31).
dddDisplays the abbreviated day (Sun to Sat).
ddddDisplays the whole day (Sunday to Saturday).
mDisplays the month number without a zero prefix (from 1 to 12).
mmDisplays the month number with a zero prefix (from 01 to 12).
mmmDisplays the abbreviated month (Jan to Dec).
mmmmDisplays the whole month (January to December).
yyDisplays the two-digit year number (00 to 99).
yyyyDisplays the four-digit year number (0000-9999).
hDisplays the hour on the 24-hour clock without a zero prefix (0 to 23).
hhDisplays the hour on the 24-hour clock with a zero prefix (00 to 23).
nDisplays the minutes without a zero prefix (0 to 59).
nnDisplays the minutes with a zero prefix (00 to 59).
sDisplays the seconds without a zero prefix (0 to 59).
ssDisplays the seconds with a zero prefix (00 to 59).
zDisplays the milliseconds without a zero prefix (0 to 999).
zzzDisplays the milliseconds with a zero prefix (000 to 999).

Examples

StrToDateTime('yyyy-mm-dd','2011-08-19')=August 19, 2011
StrToDateTime('hh:nn:ss dd.mm.yy','14:36:59 19.08.11')=August 19, 2011 14:36:59

ISO8601 string to DateTime:
StrToDateTime("yyyy-mm-ddThh:nn:ss","2025-08-18T10:42:20Z")=August 18, 2025 10:42:20

Classification

DateTime Strings