[DUG] firebird query parameters behaving oddly
John Bird
johnkbird at paradise.net.nz
Wed Jul 11 17:22:22 NZST 2007
The conclusion was I understand that dates in form
15-Nov-2006
were unambiguous, also by checking/altering the shortdate format if
required.
(Although personally I have always preferred to explicitly format my own
dates using FormatDateTime to avoid funnies on any PC I didn't forsee).
Out of curiosity - what databases accept dates in ANSI format?
Eg
2006-11-15
Or for datetimes (Timestamps)
{ ts '1990-12-31 00:00:00' }
http://technet.microsoft.com/en-us/library/ms181030.aspx
John
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Tracey
Sent: Tuesday, 10 July 2007 2:58 p.m.
To: mike at webdata.co.nz; 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] firebird query parameters behaving oddly
Thanks guys. I finally got it sorted (I must have been stuck on "stubborn"
yesterday)
sDateString := DateOK(incomingDateString);
ParamByName('dateparam').AsDate := StrToDate(sDateString);
*sigh*
Go away from your code for a year or two and you'd think it belonged to
someone else!
Sorry for giving y'all the runaround
Tracey
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Mike Stokes
Sent: Tuesday, 10 July 2007 2:43 p.m.
Cc: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] firebird query parameters behaving oddly
True,
So to get past this look at using
function EncodeDateTime(const AYear, AMonth, ADay, AHour, AMinute,
ASecond, AMilliSecond: Word):TDateTime;
this is found in DateUtils.
Then you can break your string date time value into parts in order to
convert them to a TDateTime value.
But Cheng Wei's solution also works e.g. '10-jul-2007'
All the best,
Mike
Jeremy North wrote:
>> For simple date time conversions check the ShortDateFormat :=
>> 'dd/mm/yyyy'; before converting StrToDateDef(MyDate, 0);
>
> FWIW setting those variables in SysUtils (ShortDateFormat et al.) is
> not thread safe. So if you are using threads you may run into issues.
>
> cheers,
> Jeremy
>
>
>
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe
__________ NOD32 2245 (20070506) Information __________
This message was checked by NOD32 antivirus system. http://www.eset.com
More information about the Delphi
mailing list