Subject | Re: English Date Format |
---|---|
Author | Adam |
Post date | 2006-02-03T23:40:49Z |
--- In firebird-support@yahoogroups.com, Guido Klapperich
<guido.klapperich@...> wrote:
The problem is that the strange folk on the other side think that the
month should go first ;)
so ??/??/???? will be interpreted by the server engine as mm/dd/yyyy
whereas ??.??.???? will be interpreted as dd.mm.yyyy
I have no idea what development tool you are using, but it probably
uses something like DateToString() which returns a string based on the
local region settings of the server.
There are two options:
1. (the best one) Use parameters instead of dynamically building a
string to execute. Parameters are like placeholders for values, which
means that the query can be used several times with different
parameter values without having to prepare each time (it remembers the
query plan so it is much faster). It also gets around regional
representation differences. It also prevents SQL injection attacks.
2. (less preferred) Use a different DateToString function that allows
you to format the string in a predetermined way. But I would do 1 if
possible.
Adam
<guido.klapperich@...> wrote:
>format.
> I have been working a long time with firebird on a german server with
> the date format 'dd.mm.yyyy' without any problems. Now the server has
> been moved to a London and there the date format is 'dd/mm/yyyy'. Now I
> get always conversion errors, when I want to use the english date
> Am I doing something wrong or does firebird not understand the englishGuido,
> date format?
The problem is that the strange folk on the other side think that the
month should go first ;)
so ??/??/???? will be interpreted by the server engine as mm/dd/yyyy
whereas ??.??.???? will be interpreted as dd.mm.yyyy
I have no idea what development tool you are using, but it probably
uses something like DateToString() which returns a string based on the
local region settings of the server.
There are two options:
1. (the best one) Use parameters instead of dynamically building a
string to execute. Parameters are like placeholders for values, which
means that the query can be used several times with different
parameter values without having to prepare each time (it remembers the
query plan so it is much faster). It also gets around regional
representation differences. It also prevents SQL injection attacks.
2. (less preferred) Use a different DateToString function that allows
you to format the string in a predetermined way. But I would do 1 if
possible.
Adam