I want to bulk convert my epoch values into human readable date and time value. Taking a value 1342179766, I converted it on epoch-converter and got Fri, 13 Jul 2012 11:42:46 GMT as answer which I know is correct. Now I used the java code provided on their site to convert it into date and time format but I am getting wrong answer.
Code:
String date = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date (1342179766*1000));
System.out.println(date);
Output:
12/07/1969 09:40:02
I looked at other questions on stackoverflow but mostly this code is given everywhere. I found 2-3 other code but all of them are also giving me same output.
I guess you should use
1342179766L*1000Linstead of1342179766*1000.