THANKS !! putting the month abviation in the date DID ring a bell, but I was
unable to find anything on dates....even went to work to get a couple of
books on IB, but couldn't see anything.
I can NOW do teh query as I need it to be done, THANKS heaps...I need to do
more IB work to get even more familiar with it....so used to Access and SQL
Server.
Chers,
Jeremy Coulter
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Gary T. Benner
> Sent: Sunday, March 26, 2000 12:48 PM
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Simple Question
>
>
> [Reply]
>
> HI Jeremy,
>
> There are two ways you can do it:
>
> select * from mytable
> where (myDate >= "1-JAN-2000")
> and (myDate < "1-FEB-2000");
>
> Note, this will give you everything for January 2000, considering
> that the date type in IB
> contains time information (ie its a timestamp - IB6.0 will change this)
>
> Note the formatting of the date data required by IB - in Delphi
> you format it like this:
>
> formatdatetime('d-mmm-yyyy',myDate);
>
> if you want to do time then I think this works:
>
> formatdatetime('d-mmm-yyyy hh:nn',myDateTime);
>
>
> You can also use parameters and do it like this in Delphi Code:
>
> with TQuery.create(nil) do begin
> databasename:='mydatabase';
> sql.add('select * from myTable');
> sql.add('where mydate >=:startdate');
> sql.add('and mydate < :enddate');
> parambyname('startdate').asdatetime:=datetimepicker1.date;
> parambyname('enddate').asdatetime:=datetimepicker2.date;
> open;
>
> ..
> ..
>
> finally
> free;
> end;
>
> The code above has not been compiled - I just wrote it here so
> excuse any errors, but the
> principle is there.
>
> Kindest Regards
>
> Gary
>
>
>
> At 12:40 on 26/03/2000 you wrote
>
> >To :
> >CC :
> >From: Jeremy Coulter, [EMAIL PROTECTED]
> >HI All.
> >I have been trying to work out HOW to do a query based on a date range in
> >IB.
> >I am used to the way that Access and SQL Server do their querys
> based on a
> >date range, but this doesn't work under IB.
> >I.e. SELECT * FROM myTable WHERE Date between 1/1/2000 and 1/12/200
> >or SELECT * FROM myTable WHERE Date >=1/1/2000 and Date <=1/12/200
> >
> >But neither of these worked under IB.
> >I even tried to do a query on a specific date and it didnt even return
> >anything.
> >I am wondering if its because I need to specify the TIME as well
> i.e. date
> >>= 1/1/2000 00:00:00 etc.
> >But I am not sure how to do this under IB.
> >
> >Thanks,
> >
> >Jeremy Coulter (manager)
> >Visual Software Solutions
> >145 Langdons Road
> >Christchurch
> >ph +64 3 3521595
> >fx +64 3 3521596
> >cell +21 2533214
> >http://www.vss.co.nz
> >
> >
>
>
>
> ========================================================
>
> Gary Benner - Software Developer [EMAIL PROTECTED]
> Corporate Software New Zealand Limited Auckland - New Zealand
> tel: +64-9 846-6067 (24hr) fax: +64-9 846-6152 mob: (021)-966-992
> Software System Design - Consulting - Mentoring - Data Modelling
> Client Server - Delphi - Interbase - Oracle - Web-based Technologies
> Electronic Automation and Systems - Microcontroller Design & Software
> http://www.corporate.co.nz
>
> Ref#: 41006
>
>
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz