Tuesday, March 27, 2012

How to convert Date and Time in Millisecond in android?


public long dateConvertor(String date) throws ParseException {
Date currentpastDate = null;
try {
SimpleDateFormat formatter = new SimpleDateFormat("d MMM yyyy h:mm a");
currentpastDate = (Date) formatter.parse(date);


} catch (Exception E) {
E.printStackTrace();
}
return currentpastDate.getTime();
}

No comments:

Post a Comment