0

There are multiple questions about EPOCH time, but none of them resolve my issue. I want to convert epoch time to date string and i have tried with below code and i got 1974-01-19 year but expected date would be 2020-06-22. Please help me what am missing here.

    long unix_seconds = 1555436036000;
    Date date = new Date(unix_seconds); 
    SimpleDateFormat jdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    jdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    String java_date = jdf.format(date);
    System.out.println("\n"+java_date+"\n");

Why am i getting different date ?

user2848031
  • 187
  • 12
  • 36
  • 69

0 Answers0