I am looping through the call log and saving the dates of the calls into an array. During this process, I get dates like 1315164925580.
Part of the call log loop:
int dateColumn = c.getColumnIndex(android.provider.CallLog.Calls.DATE);
long callDate = c.getLong(dateColumn);
I can turn this long into a date:
SimpleDateFormat datePattern = new SimpleDateFormat ("yyyy-MM-dd");
Long datelong = Long.parseLong("1315164925580");
String date_str = datePattern.format(new Date(datelong));
Results: 2011-09-04
How can I extract the time of calls?
You should use DateFormat.getDateTimeInstance method instead of SimpleDateFormat and if neaded specify output format in get method.