Board index » delphi » Interbase date time question

Interbase date time question

Hi,

I didn't find an interbase newsgroup so i'll try this one.

I want to get all records where the TS_begin field is between 2 datetimes.
How do i do this.
I also want the datetimes to appear dd/mm/yy H:mm so not mm/dd ... where can
i adjust this.
How do i make the query from within delphi.

Interbase doesn't seem to have a 'between' function so i thought of

select * from TIMESHEET where
(TS_BEGIN >  :start) and
(TS_BEGIN < :end)

but this gives only 1 record where there supposed to be 3.
(replace the params in delphi with:
DayQuery.ParamByName('start').Value := FormatDateTime('dd-mm-yyyy 00:00:00',
dag);
DayQuery.ParamByName('end').Value := FormatDateTime('dd-mm-yyyy 23:59:59',
dag + 6);

Any help?

Thanks in advance,

Stijn Verrept.

 

Re:Interbase date time question


a. To select an entire week I would use:

DayQuery.SQL.Text :=
  'select * ' +
  'from TIMESHEET ' +
  'where (TS_BEGIN >= :start) ' +
  'and (TS_BEGIN < :end)';
DayQuery.ParamByName('start').AsDateTime := dag;
DayQuery.ParamByName('end').AsDateTime := dag + 7;

b. You can alter the way Delphi displays date/time with the following
variables from the SysUtils unit:
DateSeparator: Char;
ShortDateFormat: string;
LongDateFormat: string;
TimeSeparator: Char;
TimeAMString: string;
TimePMString: string;
ShortTimeFormat: string;
LongTimeFormat: string;
ShortMonthNames: array[1..12] of string;
LongMonthNames: array[1..12] of string;
ShortDayNames: array[1..7] of string;
LongDayNames: array[1..7] of string;
EraNames: array[1..7] of string;
EraYearOffsets: array[1..7] of Integer;
TwoDigitYearCenturyWindow: Word = 0;

"Stijn Verrept" <sverr...@vub.ac.be> schreef in bericht
news:97u2qg$l01$1@snic.vub.ac.be...

Quote
> Hi,

> I didn't find an interbase newsgroup so i'll try this one.

> I want to get all records where the TS_begin field is between 2 datetimes.
> How do i do this.
> I also want the datetimes to appear dd/mm/yy H:mm so not mm/dd ... where
can
> i adjust this.
> How do i make the query from within delphi.

> Interbase doesn't seem to have a 'between' function so i thought of

> select * from TIMESHEET where
> (TS_BEGIN >  :start) and
> (TS_BEGIN < :end)

> but this gives only 1 record where there supposed to be 3.
> (replace the params in delphi with:
> DayQuery.ParamByName('start').Value := FormatDateTime('dd-mm-yyyy
00:00:00',
> dag);
> DayQuery.ParamByName('end').Value := FormatDateTime('dd-mm-yyyy 23:59:59',
> dag + 6);

> Any help?

> Thanks in advance,

> Stijn Verrept.

Re:Interbase date time question


the forums to use for this question are :
borland.public.interbase
borland.publi.delphi.database.interbaseexpress

A +

Stijn Verrept a crit :

Quote

> Hi,

> I didn't find an interbase newsgroup so i'll try this one.

> I want to get all records where the TS_begin field is between 2 datetimes.
> How do i do this.
> I also want the datetimes to appear dd/mm/yy H:mm so not mm/dd ... where can
> i adjust this.
> How do i make the query from within delphi.

> Interbase doesn't seem to have a 'between' function so i thought of

> select * from TIMESHEET where
> (TS_BEGIN >  :start) and
> (TS_BEGIN < :end)

> but this gives only 1 record where there supposed to be 3.
> (replace the params in delphi with:
> DayQuery.ParamByName('start').Value := FormatDateTime('dd-mm-yyyy 00:00:00',
> dag);
> DayQuery.ParamByName('end').Value := FormatDateTime('dd-mm-yyyy 23:59:59',
> dag + 6);

> Any help?

> Thanks in advance,

> Stijn Verrept.

--
Frdric BROUARD,  dit "Le PERROQUET"  dixit lib!
***** http://perso.club-internet.fr/brouardf *****
SQL ? dbutant ou pro ?? www.multimania.com/sqlpro
*****    mailto:broua...@club-internet.fr    *****

Other Threads