Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all I am new to talend sorry for the mistakes, my question is how to convert epoch timestamp into GMT0;
I am getting epoch time = "
1631898440"
as string I tried converting it into timestamp like this -(row1.datecolumn==null || row1.datecolumn=="" )?null:
(new java.util.Date(Long.parseLong(row1.datecolumn) * 1000));
with this the output that I am getting is = 2021-09-17 22:37:20 here talend is taking my system's timezone I guess.
but the time I need is = 2021-09-17 5:07:20 pm
which is GMT0
How can I achieve this please help
Hi
Change the timezone in the begging of job, add this code on a tJava:
java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("UTC"));
Let me know if it works.
Regards
Shong
Hi Shong, thank you for the suggestion but it didn't work!
I tried and I am able to get the date output like this:
2021-09-17 17:07:20
if you want to have
2021-09-17 5:07:20 pm
You need to set the date pattern as "yyyy-MM-dd hh:mm:ss aa" of this column on schema.