How to convert CallLog.calls.DATE into dateFormat?

Last Updated:

  1. saranya

    saranya Member

    public static Date formatDate(String dateString){
    Date callDate=new Date();
    }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();
    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

  2. adangelo

    adangelo Member

    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):
    2. int callDate = callcur.getInt(dateColumn);
    3. Date date=new Date(callDate);

Share This Page