I have one date and time format as below:
Tue Apr 23 16:08:28 GMT+05:30 2013
I want to convert into milliseconds, but I actually dont know
You can use this code
long miliSecsDate = milliseconds ("2015-06-04");
Log.d("miliSecsDate", " = "+miliSecsDate);
public long milliseconds(String date)
{
//String date_ = date;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try
{
Date mDate = sdf.parse(date);
long timeInMilliseconds = mDate.getTime();
System.out.println("Date in milli :: " + timeInMilliseconds);
return timeInMilliseconds;
}
catch (ParseException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}