[DUG] firebird query parameters behaving oddly
Steve Peacocke
steve.peacocke at gmail.com
Tue Jul 10 13:33:43 NZST 2007
Tracey,
I think you are still on Firebird 1.5??
By memory (what little I have left) that version REQUIRED that all
dates are US format (after all, everyone in the whole world uses the
US date format don't they?). Passing dates in parameters overcomes
this.
I'll call you.
Steve
--
Steve Peacocke
http://stevepeacocke.blogspot.com/
On 10/07/07, Tracey <tracey at logis.co.nz> wrote:
> Well the problem is that the date is being fed into Firebird as "10/11/2007"
> but firebird is reading it as "11/10/2007"
>
> Even constructing the dates as you suggest does not help.
>
> :(
>
> Anyone here ever struck these bazaar locale errors where I only have the one
> locale on my machine, (US locale removed at install) and yet I am having
> these US date problems (same problem within SQL Server). I have strolled
> through the registry and the only items with language set to US are:
>
> my graphics card (where userlanguage is set to Eng(nz) anyway),
>
> My dotnet compact frameworks,
>
> HKEY_LOCAL_MACHINE\SOFTWARE\ITConcepts\onecard SETUPLANGUAGE, whatever that
> is (possibly my credentials management or something),
>
> HKEY_ USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\ThemeManager
> LASTUSERLANGUAGEID
> And
> HKey_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager
> LASTUSERLANGUAGEID
>
> ARRGGGHHHHHHH
>
>
> -----Original Message-----
> From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
> Behalf Of Steve Peacocke
> Sent: Tuesday, 10 July 2007 12:50 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] firebird query parameters behaving oddly
>
> On 10/07/07, Tracey <tracey at logis.co.nz> wrote:
> > Difficult.
> >
> > I use a javascript calendar picker to populate dates formatted dd/MM/yyyy
> > (user requirements) which is passed via "textbox.value" to a javascript
> > function which in turn passes the value directly back to my Delphi app.
> >
>
> Good Afternoon Tracey,
>
> Could you use EncodeDate(), which will ensure that you are passing the
> actual date as you would like. E.g. ...
>
> // sDate = your date string = dd/mm/yyyy = '10/07/2007'
> // d, m, y : Word;
> Try
> d := StrToInt(copy(sDate, 1, 2));
> m := StrToInt(copy(sDate, 4, 2));
> y := StrToInt(copy(sDate, 7, 4));
> MyDate := EncodeDate(y, m, d);
> except
> ShowMessage('Not a date');
> end;
>
> Steve
> --
> Steve Peacocke
> http://stevepeacocke.blogspot.com/
> _______________________________________________
More information about the Delphi
mailing list