I am trying to convert the timestamp to date in java but I got an old date
Result Tue Jan 20 06:13:12 IST 1970
Here is my code
public static void main(String args[]){
Date date=new Date(1644192000);
System.out.println(date);
}
>Solution :
The Date class is mostly obsolete except for backwards compatibility. Instead, use the modern java.time classes:
Instant timestamp = Instant.ofEpochSecond(1644192000);
// note the second/millis difference Rob Spoor mentioned
