FromDateTime

This section contains reference documentation for the FromDateTime function.

Converts a formatted date-time string to milliseconds, based on the provided Joda-Time pattern.

Signature

FromDateTime(dateTimeString, pattern)

Usage Examples

SELECT FromDateTime('2019-08-07', 'yyyy-MM-dd') AS epochMillis
FROM ignoreMe
epochMillis

1565136000000

SELECT FromDateTime(
    '2019-08-07 3:12:13 PM', 
    'yyyy-MM-dd hh:mm:ss a'
    ) AS epochMillis
FROM ignoreMe
epochMillis

1565190733000

SELECT FromDateTime(
    '2019-08-07T15:12:13', 
    'yyyy-MM-dd''T''HH:mm:ss'
    ) AS epochMillis
FROM ignoreMe
epochMillis

1565190733000

SELECT FromDateTime(
    '2019-08-07T07:12:13-0800', 
    'yyyy-MM-dd''T''HH:mm:ssZ'
    ) AS epochMillis
FROM ignoreMe
epochMillis

1565190733000