[resolved] Conversion from Unix Epoch Time to Human Readable Datetime

One Star

[resolved] Conversion from Unix Epoch Time to Human Readable Datetime

I am trying to convert the integer (Big Decimal) 1235980865
that is converted for me in the input to 2009-03-02 00:01:05
but using the tmap and this code: new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date (row2.hit_time_gmt))
I am getting this as an output:1970-01-14 23:19:40

I am not quite certain what I am doing wrong.

Accepted Solutions
One Star

Re: [resolved] Conversion from Unix Epoch Time to Human Readable Datetime

This code works
new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date ((long)row2.hit_time_gmt))
row2.hit_time_gmt being your epoch time

All Replies
One Star

Re: [resolved] Conversion from Unix Epoch Time to Human Readable Datetime

This code works
new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date ((long)row2.hit_time_gmt))
row2.hit_time_gmt being your epoch time