Subject Re: [ib-support] FB, US vs UK date formats?
Author Phil Shrimpton
On Friday 12 July 2002 17:19, you wrote:


> I have a firebird database, developed on a machine with US settings.
> Problem is, when we switch the machine over to UK settings (To test for UK
> issues, obviously) all of my queries that have dates as literal strings are
> hosed. They need to have the date strings in US format still.

Firebird, and I stand to be corrected, stores its dates as two 32bit
integers, one for date and one for time. It also allows a limited number of
date formats to be passed as strings for 'quick tests' etc. These formats
are 'hard coded' and do not change depending on regional settings (remember
not every OS that Firebird runs on supports them at the level that Firebird
runs at.

I would certainly not use 'string' dates in a 'real' application, but they
are jolly useful when manually testing things and quick queries.

> And in fact, that's the query Delphi will spit out in my code, as all of
> it's DateToStr functions pay attention to Windows settings.

Why are you converting dates to strings, why don't you just pass the Date to
Firebird. Not only will that eliminate a Date2String and a String2Date
conversion, but it will prevent situations like you are having.

Just use the MyParam.AsDateTime method.

> To get the same results, I'd have to do the US
> query, even though my results that come up in my grid display in UK format.

If you use Date/Time types then the client application will convert them
properly when inserting and reading.

> Can someone elighten me as to what's going on?

Hopefully the above helps.


Linux 2.4.4-4GB
6:50pm up 3 days, 4:39, 1 user, load average: 0.36, 0.19, 0.07