Saturday, December 21, 2013

How To Change Unix TimeStamp To Date,Days and Hours in Java and Android.

long timeInMilliseconds = 1388205000; 
long end=timeInMilliseconds*1000; 
long current = System.currentTimeMillis(); 
long diff = end - current ;
 int hrCount = (int) ((diff / (1000 * 60 * 60)) % 24); 
int dayCount = (int) diff / (24 * 60 * 60 * 1000);

No comments:

Post a Comment