Hey again,
I'm having trouble looking up date values in my database.
When I say
No results are returned even though there was a shipment created today.Code:...WHERE Shipments.ShipmentDate=#07/16/2009#...
If I say
I retrieve all results non-inclusive of 7/16/2009.Code:...Shipments.ShipmentDate BETWEEN #07/10/2009# AND #07/16/2009#
I believe this is because the Date/Time field in the database also stores the time. Since the time is stored as the fractional part and assumed to be zero when no fractional part is specified, saying 7/16/2009 is actually the equivalent of saying 7/16/2009 12:00AM.
That makes sense and explains the non-inclusive factor of the between statement as well as why I can't pull up the correct date using =.
I suppose what I need to do is find a way to ignore the timestamp for comparisons (or don't use a timestamp when I save to the DB - something I'd rather not do).
Anyone know of a way to do this?




Reply With Quote