question

ChetanPrakashSaraswat-8062 avatar image
0 Votes"
ChetanPrakashSaraswat-8062 asked KranthiPakala-MSFT commented

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

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ChetanPrakashSaraswat-8062 avatar image
0 Votes"
ChetanPrakashSaraswat-8062 answered KranthiPakala-MSFT commented

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.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you.. Looks kind of similar to above solution.

0 Votes 0 ·
KranthiPakala-MSFT avatar image KranthiPakala-MSFT ChetanPrakashSaraswat-8062 ·

Hi @chetanprakashsaraswat-8062,

Thanks for sharing your solution here. Please feel free to click 130616-image.png and upvote 130671-image.png on your own answer as it could be beneficial for other community members who read this thread.


Thank you

0 Votes 0 ·