CallLog.Calls DATE returning negative

Put your problem here if it does not fit any of the other categories.

CallLog.Calls DATE returning negative

Postby zookie » Fri Jul 02, 2010 4:01 pm

Hi,

Documentation says that CallLog.Calls.DATE returns milliseconds since epoch. This is true, but mine is returning a negative number.

So I have:
int dateColumn = c.getColumnIndex(android.provider.CallLog.Calls.DATE);

int callDate = c.getInt(dateColumn);

The value returned is: -1856117447

So even after my conversion I end up with Dec 10 1969.

Anyone have any ideas?

Regards,
Zookie
zookie
Freshman
Freshman
 
Posts: 9
Joined: Mon Jun 28, 2010 4:12 am

Top

Re: CallLog.Calls DATE returning negative

Postby anarche » Sat Jul 03, 2010 1:07 am

Try c.getLong(dateColumn)

I reckon the integer is wrapping the long bits back round to negatives due to the large number of milliseconds since epoch.
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: CallLog.Calls DATE returning negative

Postby zookie » Tue Jul 06, 2010 12:01 am

Absolutely perfect! I was away all weekend for the holiday and have been itching to get back and try this. Works great, thanks!
zookie
Freshman
Freshman
 
Posts: 9
Joined: Mon Jun 28, 2010 4:12 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 14 guests