Top  | Previous | Next

Type Casting / toDate

toDate(value, [failover])

Tries to coerce value into a Date. If value is a number or a string that represents a number, the number is treated as the number of milliseconds since the epoch, January 1, 1970, 00:00:00 GMT. If value is a string, it is parsed to see if it represents a date in one of these two formats: "yyyyMMdd.HHmmssSSSZ" or "yyyy-MM-dd HH:mm:ss". If not, type casting fails.

The failover value must be a number or string with the same restrictions.

 

toDate("2007-04-12 16:28:22")

... returns April 12th, 2007, 4:28:22 PM