I am developing an Android application in that I wants to get Millisecond from Date-Time.
I am using below code for the parsing but I can't get proper result.
public static long getTimeInMillisecond(String time) {
// eg. time = "27 Sep 2016 12:24PM";
final SimpleDateFormat sdf = new SimpleDateFormat(
"dd MMM yyyy hh:mma");
sdf.setTimeZone(TimeZone.getDefault());
try {
Date mDate = sdf.parse(time);
long timeInMilliseconds = mDate.getTime();
return timeInMilliseconds;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}