yasselma
yasselma

Reputation: 11

convert an epoch timestamp to datetime in azure data factory

I'm working with data flow in azure data factory and i tried to convert an epoch formatted timestamp to date.

the value of the timestamp is '1574067907751' and i tried expressions : toDate(toTimestamp(1574067907751*1000l)) or toDate(toTimestamp(toInteger('1574067907751')*1000l,'yyyy-MM-dd HH:mm:ss'))

there is any other way to do that ?

Upvotes: 1

Views: 4665

Answers (2)

Bennimi
Bennimi

Reputation: 512

Just in case someone is wondering:

If the timestamp comes in milliseconds, one need to cast the timestamp as long.

toTimestamp(toLong(time_milliseconds))

Upvotes: 1

Mark Kromer MSFT
Mark Kromer MSFT

Reputation: 3838

https://learn.microsoft.com/en-us/azure/data-factory/concepts-data-flow-expression-builder#convert-to-dates-or-timestamps

"To convert milliseconds from epoch to a date or timestamp, use toTimestamp(). If time is coming in seconds, multiply by 1,000.

toTimestamp(1574127407*1000l)

The trailing "l" at the end of the previous expression signifies conversion to a long type as inline syntax."

Upvotes: 3

Related Questions