Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Excerpt
hiddentrue

 toDate(dateString) Converts a date in text into an actual date type.


Function: toDate()

Converts a standard PhixFlow date string (e.g. 20120521 or 20120521.172108) into a true date, or a non-standard date string into a true date if supplied with a format pattern.

...

Returns null if dateString is null.

Note

Beware of daylight savings clock changes! In countries where daylight savings are applied, at the point of the year when the clocks go forward, a hour will be lost. If you have a date and time that happen to fall into this missing hour, when you run a toDate() on the value, you will get an error like

Code Block
failed: Unable to convert the string "26/03/2017 01:00:15" into a date. Valid formats include dd/MM/yyyy, dd/MM/yyyy HH:mm:ss



Syntax

toDate(dateString)

toDate(dateString, formatString)

...

SymbolMeaningPresentationExamples
GeratextAD
Ccentury of era (>=0)number20
Yyear of era (>=0)year1996
xweekyearyear1996
wweek of weekyearnumber27
eday of weeknumber2
Eday of weektextTuesday; Tue
yyearyear1996
Dday of yearnumber189
Mmonth of yearmonthJuly; Jul; 07
dday of monthnumber10
ahalfday of daytextPM
Khour of halfday (0~11)number0
hclockhour of halfday (1~12)number12
Hhour of day (0~23)number0
kclockhour of day (1~24)number24
mminute of hournumber30
ssecond of minutenumber55
Sfraction of secondnumber978
ztime zonetextPacific Standard Time; PST
Ztime zone offset/idzone-0800; -08:00; America/Los_Angeles
'escape for textdelimiter 
''single quoteliteral'

The number of letters used in the pattern determines the format.

...