a section of my program that im writing requires some data comparisons betweens the current date and a date stored in the database. im running into 2 problems atm which i cant see to fix.
1. inserting the dates into the database
orginally i was using strings but was told it is better to use the DATE type. ive got a text field for a date in which the format is checked to be consistent to dd/mm/yyyy using a small class i wrote (returns a boolean) before a new record is added to the database. this was working fine with the date being stored as a string but now i am using a DATE and a date like 20/04/2006 wont be stored in the db as 2006-04-20 instead its stored as something slightly random.
2. retrieving dates from the database
i am trying to exract the date from the database using the resultset.getDate("startDate") method into a java.util.date object. from here i want to compare it to another date object (the current date) to test if the retreived date is less than say x weeks away (then do my intended handling of the data).
any help would be appreciated! i havent got much hair left to pull out!
[ April 20, 2006: Message edited by: Deyna Cegielski ]
1. inserting the dates into the database
orginally i was using strings but was told it is better to use the DATE type. ive got a text field for a date in which the format is checked to be consistent to dd/mm/yyyy using a small class i wrote (returns a boolean) before a new record is added to the database. this was working fine with the date being stored as a string but now i am using a DATE and a date like 20/04/2006 wont be stored in the db as 2006-04-20 instead its stored as something slightly random.
2. retrieving dates from the database
i am trying to exract the date from the database using the resultset.getDate("startDate") method into a java.util.date object. from here i want to compare it to another date object (the current date) to test if the retreived date is less than say x weeks away (then do my intended handling of the data).
any help would be appreciated! i havent got much hair left to pull out!
[ April 20, 2006: Message edited by: Deyna Cegielski ]