Conversion from EPOCH milliseconds to Date

Five Stars

Conversion from EPOCH milliseconds to Date

Hi,

 

I have some epoch numbers stored as type long in milliseconds.

examples are:

1517408220000

1456932600000

 

Using an online converter (https://currentmillis.com/) i get the following which is correct:

Wed Jan 31 2018 14:17:00

Wed Mar 02 2016 15:30:00

 

What would the expression be to do this within a TMap, although i would want the output formatted differently as dd/mm/yyyy.

 

Please could anyone assist me.

 

Thank you

 

 


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: Conversion from EPOCH milliseconds to Date

Twelve Stars

Re: Conversion from EPOCH milliseconds to Date

you can use below way in tmap.
new java.util.Date((long)(row1.Epoch*1000)/1000)

i just created a job for you,please check the job

Manohar B

All Replies
Forteen Stars TRF
Forteen Stars

Re: Conversion from EPOCH milliseconds to Date

Twelve Stars

Re: Conversion from EPOCH milliseconds to Date

you can use below way in tmap.
new java.util.Date((long)(row1.Epoch*1000)/1000)

i just created a job for you,please check the job

Manohar B
Five Stars

Re: Conversion from EPOCH milliseconds to Date

Thank you. I followed this before and realised now that i needn't multiply by 1000.