dcsimg
Date problems with access
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   h_kumar
Posted On:   Sunday, February 16, 2003 08:41 AM

I am trying to query MS Access database, from my Java program using JDBC calls. I tried to use various date formats such as 01/30/2003, 2003-01-30 etc - the condition was where sent_date = '01/30/2003', I would not get any results unless I use >= '01/30/2003'. Looks like JDBC transforms the date into some format which access doesnot understand. Initially my date field in access database is defined as DATE/TIME but later on I changed the Definition to Short Date, but none of them would work unless I use >= in my expression. My intention is to get the data for that date only. Can anybody help.

Re: Date problems with access

Posted By:   Jeanne_Boyarsky  
Posted On:   Sunday, February 16, 2003 03:43 PM

First of all, you should consider using a prepared statement so you don't have to worry about getting the date syntax right.


Access is trying to find matches for 1/30/03 at exactly midnight. As it is unlikely that your transactions occurred at this exact time, the query doesn't work. You need to use:
send_date > '01/29/2003' and send_data < '01/31/2003'

The Calendar class is good for adding/subtracting one day from your original date.
About | Sitemap | Contact