Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old October 21st, 2008, 02:46 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2008
Posts: 9
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Unhappy How to convert CallLog.calls.DATE into dateFormat?

public static Date formatDate(String dateString){
Date callDate=new Date();
try{
callDate=DateUtils.parseDate(dateString);
}catch(Exception e){
Log.v("CallLog","Exception in FormatDate"+e.getMessage());
}
return callDate;
}
I am using this method to get date format.But it show me the exception
like this: VERBOSE/CallLog(530): Exception in FormatDateUnable to parse the date 429578575
int callDate = callcur.getInt(dateColumn);
Date date=new Date();
dateStr=dateStr.valueOf(callDate);
date=formatDate(String.valueOf(dateStr));
In this way i passed the value from android.provider.CallLog.calls.DATE
So please tell me mistake I did in this.And how to correct that
Thanks in advance
saran

saranya is offline  
Reply With Quote
sponsored links
Old October 21st, 2008, 01:14 PM   #2 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 8
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 4 Times in 2 Posts
Default

From what package is the static DateUtils.parseDate(dateString) you are using? I have a feeling you are using the org.apache.http.impl.cookie.DateUtils version which is meant to parse html date formats.

I don't have a compiler in front of me to try, but I suspect that the android.provider.CallLog.calls.DATE is a millisecond format that could just get passed to the java.util.Date(long millisecondTime) constructor.

Try this:
Code:
int callDate = callcur.getInt(dateColumn);
Date date=new Date(callDate);
adangelo is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:59 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.