1. Download our Official Android App: Forums for Android!

Apps How to convert CallLog.calls.DATE into dateFormat?

Discussion in 'Android Development' started by saranya, Oct 21, 2008.

  1. saranya

    saranya Lurker
    Thread Starter
    Rank:
    None
    Points:
    6
    Posts:
    9
    Joined:
    Oct 17, 2008

    Oct 17, 2008
    9
    1
    6
    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
     

    Advertisement

  2. adangelo

    adangelo Lurker
    Rank:
    None
    Points:
    6
    Posts:
    8
    Joined:
    Oct 20, 2008

    Oct 20, 2008
    8
    4
    6
    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 (Text):
    1.  
    2. int callDate = callcur.getInt(dateColumn);
    3. Date date=new Date(callDate);
    4.  
     

Share This Page

Loading...