[Lazarus] Filtering on date with TDbf

waldo kitty wkitty42 at windstream.net
Tue Jan 31 21:48:08 CET 2012


On 1/31/2012 07:59, Michael Joyner wrote:
> to be able to compare dates as strings, you should always set the format as
> year-month-day

+100

i tend to use yyyymmddhhkkssjjjjj   where kk is minutes and jj us hundreths of 
seconds where available... at least this for _simple_ before/equal/after 
comparisons... anything else requires more work ;)

> On Tue, Jan 31, 2012 at 7:55 AM, Guionardo Furlan <guionardo at gmail.com
> <mailto:guionardo at gmail.com>> wrote:
>
>     This code works in delphi?
>     Comparing strings doesn´t work for dates, I guess.
>     Using mm/dd/yyyy, "05/01/2012" is less/before than "05/02/2011"
>
>     2012/1/30 Koenraad Lelong <lazarus1 at de-brouwerij.be
>     <mailto:lazarus1 at de-brouwerij.be>>:
>      > Hi,
>      >
>      > Lazarus 0.9.30
>      >
>      > I want to filter a TDbf. The field is a date.
>      > When I try in Filter in Lazarus :
>      > DATUM >= '1/1/2011'
>      >  or
>      > DATUM >= "1/1/2011"
>      >  or
>      > DATUM >= '1.1.2011'
>      >
>      > In my application :
>      > tblTik.Filter:='DATUM>='''+DateToStr(XferStart)+'''';
>      >
>      > I get an error :
>      > Index based on unknown field ">=".
>      >
>      > What am I doing wrong ?
>      >
>      > Regards,
>      >
>      > Koenraad Lelong.




More information about the Lazarus mailing list