Board index » delphi » Month/Year date fields

Month/Year date fields

Is there a date type picture in paradox to support mm/yy (or mm/yyyy).
Presently we are storing the month and year as two integers.  I need to
do date type calculations.

In Clarion I had a mm/yyyy ( a D-13 type, I think).

We have Orpheus 2.15 and thought that'd do the trick but are not really
any closer.

If no date type picture, can someone help me with doing mm/yyyy
calculations against other date types and system date.

TIA
Larry Killen
TRW Systems Integration Group

 

Re:Month/Year date fields


Quote
Larry Killen wrote in message <364C46D2.774AC...@CDC.GOV>...
>Is there a date type picture in paradox to support mm/yy (or mm/yyyy).
>Presently we are storing the month and year as two integers.  I need to
>do date type calculations.

>In Clarion I had a mm/yyyy ( a D-13 type, I think).

>We have Orpheus 2.15 and thought that'd do the trick but are not really
>any closer.

>If no date type picture, can someone help me with doing mm/yyyy
>calculations against other date types and system date.

>TIA
>Larry Killen
>TRW Systems Integration Group

There was a TI on the Inprise site about how Paradox deals with dates I
believe it was TI3076 for Paradox. Beyond that take a close look at your
Date and Time Routines in the online help for Delphi. Of particular interest
to you would be the decodedate and encodedate procedures

Wes

Re:Month/Year date fields


Larry,

Paradox date fields and the Delphi TDateTime type encode dates as the
number of days since Queen Victoria's 80th birthday (OK, I jest - but
it's not far out).

In SQL queries you can get the month (and/or year) from date fields
like this:
    Select * from <table1>
    Where extract(month from <datefield in table1>) = extract(month
from <datefield in table2>)

Alternatively, you can get the start and end of a month by doing
something like this:

    var
        Day, Month, Year: Word;
        StartDate, EndDate: TDateTime;
    DecodeDate(<any TDateTime variable or date field>, Year, Month,
Day);
    Day := 1;
    StartDate := EncodeDate(Year, Month, Day);
    Month := Month + 1;
    if Month > 12 then
    begin
        Month := 1;
        Year := Year + 1;
    end;
    EndDate := EncodeDate(Year, Month, Day) - 1;

--
Stephen Brown

Quote
Larry Killen wrote in message <364C46D2.774AC...@CDC.GOV>...
>Is there a date type picture in paradox to support mm/yy (or
mm/yyyy).
>Presently we are storing the month and year as two integers.  I need
to
>do date type calculations.

>In Clarion I had a mm/yyyy ( a D-13 type, I think).

>We have Orpheus 2.15 and thought that'd do the trick but are not
really
>any closer.

>If no date type picture, can someone help me with doing mm/yyyy
>calculations against other date types and system date.

Other Threads