I am trying to get time(long type) from the given datetime string.
While searching, I found these two ways but both are not working for me.
Code:
//import net.rim.device.api.i18n.DateFormat;
//import java.text.DateFormat;
String dateString="9/14/2010 3:59:27 PM";
DateFormat df = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa");
Date date=df.parse(dateString);
long time=date.getTime();
In above code, the problem is in df.parse(dateString);
There is no parse method for net.rim.device.api.i18n.DateFormat.
and when I tried to import "java.text.DateFormat", it says "cannot be resolved", i.e., package not found.
Code:
String dateString="9/14/2010 3:59:27 PM";
Date date= new Date(HttpDateParser.parse(dateString));
long time=date.getTime();
In this code, the second line date will result 0 millisecond.
What will be the solution?