Mapping data flow expression for converting simpledate time format to epoch timestamp

Chetan Prakash Saraswat 31 Reputation points
2021-10-11T12:13:48.183+00:00

There are existing functions where in we can convert datetime from epoch to other formats. What could be the possible function combination to convert a particular datetime as below to epoch timestamp.

Ex:
lastconnected: "2018-09-21T16:47:53.5633865Z"

converted from above to timestamp as first step using below

toTimestamp(lastconnected,'yyyy-MM-dd\'T\'HH:mm:ss', 'GMT')

but further how to convert it into epoch time. Tried add or subtract days and using the other "secondds" or milliseconds functions, but not working..

need lastconnected in epoch format as output.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Chetan Prakash Saraswat 31 Reputation points
    2021-10-11T14:39:28.797+00:00

    toLong(rtrim(toString(toTimestamp(lastconnected,'yyyy-MM-dd\'T\'HH:mm:ss', 'GMT')-toTimestamp('1970-01-01T00:00:00','yyyy-MM-dd\'T\'HH:mm:ss', 'GMT')),'000'))

    Got a solution using above method, however wanted to check if there is any other way of doing the same.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.