get long from date java

Solutions on MaxInterview for get long from date java by the best coders in the world

showing results for - "get long from date java"
Amelia
10 Jun 2020
1String string_date = "12-December-2012";
2
3SimpleDateFormat f = new SimpleDateFormat("dd-MMM-yyyy");
4try {
5    Date d = f.parse(string_date);
6    long milliseconds = d.getTime();
7} catch (ParseException e) {
8    e.printStackTrace();
9}