I am getting a date value as 1598331600000 from a API call
I am trying to convert this to Readable format using SimpleDateFormat
But i am getting Out of Range Compile Time Error in the Date Constructor
This is my Program
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
Calendar cal = Calendar.getInstance();
Date date = new java.sql.Date(1598331600000);
SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMddyyyy");
String formattedDate = sdf.format(date);
System.out.println(formattedDate);
}
}
Could you please let me know how to resolve this error .