Subject Re: [firebird-support] Re: Delphi and Firebird
Author Martijn Tonies
Hi,

> > > At the moment I query a table between date with the use of parameters.
> > >
> > > as in
> > >
> > > select *
> > > from x
> > > where A = :MyDate
> > >
> > > With the use of parameters, you just pas :MyDate as a Date and you
> > > don't have to worry about the right formatting of the Date.
> > >
> > > Now, because of circumstances, I would like to not use parameters, but
> > > I would like to create the sql code on the fly, as in
> > >
> > > select *
> > > from x
> > > where A = '2003/01/20'
> > >
> > > Is there a way to know the exact format to be used?
> >
> > The US format:
> > MM/DD/YYYY
> >
> > But: why?
>
> In the new way I need to write the query as a string. So I need to
> convert all the values into strings.
> Isn't is so that when you use the wrong dateformat, you get not result
> from the query?

Well, with parameters you're avoiding that issue :-)

> does firebird gives the same result in
>
> select *
> from x
> where a = '08/12/2004'
>
> and
>
> select *
> from x
> where a = '08.12.2004'

No. I believe when using the "/", you should use MM/DD/YYYY
while with "." you should use DD.MM.YYYY

> or?
>
> select *
> from x
> where a = '20/12/2004' (european notation)

This won't work.

> I thought that the firebird format was based on the OS on which
> firebird is running. Or is it always the US Format?

It's unaffected by OS settings - it has its own set of available
formats.

Mind you, the tool you're using to display the date as the
result of a SELECT query probably uses the OS settings.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com