Answers for "SimpleDateFormat to long time"

2

get long from date java

String string_date = "12-December-2012";

SimpleDateFormat f = new SimpleDateFormat("dd-MMM-yyyy");
try {
    Date d = f.parse(string_date);
    long milliseconds = d.getTime();
} catch (ParseException e) {
    e.printStackTrace();
}
Posted by: Guest on March-28-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language