Conversion from EPOCH milliseconds to Date

Highlighted
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
Fifteen Stars TRF
Fifteen Stars

Re: Conversion from EPOCH milliseconds to Date

Forteen 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
Don't forget to give kudos/accept the solution when a replay is helpful.

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: Conversion from EPOCH milliseconds to Date

Forteen 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
Don't forget to give kudos/accept the solution when a replay is helpful.
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.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog