R: Date types in where clause of PreparedStatement

Started by Paolo Sinigagliaabout 25 years ago2 messagesgeneral
Jump to latest
#1Paolo Sinigaglia
sini@informativesystem.it

Can anybody show any reason why the code using a prepared
statement with a where clause using a date won't find any records
on PostgreSQL but WILL work using Access and the jdbc-odbc
bridge?

Assuming you are running PostgreSQL on a *nix machine and the odbc client on
a Win* different machine, couldn't be a problem of different locale
settings?

Using Delphi BDE I had **a lot** of troubles on an all-windows-98 network
because of different locale settings among the clients. First in all,
day-month swapping in dates (dd-mm-yyyy and mm-dd-yyyy formats mixed through
the network).

#2Eric G. Miller
egm2@jps.net
In reply to: Paolo Sinigaglia (#1)
Re: R: Date types in where clause of PreparedStatement

On Thu, Mar 01, 2001 at 05:33:21PM +0100, Paolo Sinigaglia wrote:

Can anybody show any reason why the code using a prepared
statement with a where clause using a date won't find any records
on PostgreSQL but WILL work using Access and the jdbc-odbc
bridge?

Assuming you are running PostgreSQL on a *nix machine and the odbc client on
a Win* different machine, couldn't be a problem of different locale
settings?

Using Delphi BDE I had **a lot** of troubles on an all-windows-98 network
because of different locale settings among the clients. First in all,
day-month swapping in dates (dd-mm-yyyy and mm-dd-yyyy formats mixed through
the network).

Make all dates ISO format and life should be good. I think MS Access
does something like that for ODBC. So, yyyy-mm-dd ('2001-03-01') or
dd-MMM-yyyy ('01-Mar-2001'), are good candidates. For time as well:

yyyy-mm-dd hh:mm[:ss[-hh[mm]]] '2001-03-01 23:42:58-0800'

Always having year first makes a good heuristic that date/time is in ISO
format, and there's no question that each successive part represents a
decreasing date/time part.

--
Eric G. Miller <egm2@jps.net>