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

Apps Java Date Comparison with sqlite date

Discussion in 'Android Development' started by beedge, Jul 22, 2010.

  1. beedge

    beedge Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jul 20, 2010

    Jul 20, 2010
    2
    0
    5
    Hey all.,

    Im still quite new to Android and havent done Java since I left college 7 years ago, my background is in php and I never realised how convenient teh strtotime and date functions in that language are!

    My problem is that I am trying to store a date in my sqlite database and retrieve it to compare with a java date object (i.e todays date)

    Ive tried everything I can find on the net but nothing seems to work.

    what I want to do specificly is check to see if the last use of the app occurred before or after today (i.e 12.01am)

    is there any pointers on how to do this? the most common error I am running into is that date type java.utils.date and java.sql.date are incompatible

    I want them to be date objects because I want to use something like

    if ( date1.isbefore(date2) ){
    }

    is there any one out there who has run into similar problems?

    if so, PLEASE HELP"!!!!

    its driving me batty!

    Beedge
     

    Advertisement

  2. jonbonazza

    jonbonazza Android Expert
    Rank:
    None
    Points:
    163
    Posts:
    1,930
    Joined:
    Jul 13, 2010

    Jul 13, 2010
    1,930
    457
    163
    Male
    You could retreive the date from the database in a string and then convert it to a java date.
     

Share This Page

Loading...