In my android app, i am getting date and time in following format via HTTP request.
Tue Apr 17 16:23:33 IST 2012
Now i want to calculate the time difference between that time and current time.I have got lot of ways to calculate time difference in the internet but all those solutions are with different formats.How can i calculate time difference with above time format?
Edit:
This is the code i used its working fine.
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
Date dateOne = df.parse("Tue apr 22 13:07:32 IST 2012");
Date dateTwo = df.parse("Tue Apr 22 13:07:33 IST 2012");
long timeDiff = Math.abs(dateOne.getTime() - dateTwo.getTime());
System.out.println("difference:" + timeDiff); //differencs in ms
but i have to take current time in format “Tue apr 22 13:07:32 IST 2012” to use as dateTwo.
you can also this code:::