Answers for "get java time long"

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
0

current time in long java

long millis = System.currentTimeMillis();
Posted by: Guest on September-15-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language