long to datetime java code example
Example 1: 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();
}
Example 2: java long to int
public class LongToIntExample2{
public static void main(String args[]){
Long l= new Long(10);
int i=l.intValue();
System.out.println(i);
}
}