I’m getting the date from an sms message in android as a time stamp in seconds or milliseconds from epoch.I need to display it as standard date and time using java.
int date = (cursor.getColumnIndex(SmsReceiver.DATE));
this returns some number like 1308114404722.
what is the process to use this number and display as current date
To format a
Dateobject, use for exampleSimpleDateFormat:Also, you should store number-of-milliseconds-since-epoch values in a
long, not in anint, because anintis not large enough. (In fact, the number 1308114404722 doesn’t even fit in a 32-bitint).