How can i convert this time and date which coming from json data in android to milliseconds properly ??
2013-09-19T03:27:23+01:00
and what's the meaning of T ??
not sure about and what's the meaning of T ??
but you can use following code to get milliseconds.
String dateString="2013-09-19T03:27:23+01:00";
if (dateString != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date testDate = null;
try {
testDate = sdf.parse(dateString);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Milliseconds==" + testDate.getTime());
}
try something like this
String myDate = new String("your date");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-ddTHH:mm:ss");
Date date = format.parse(myDate);
date.getTime();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.