Search code examples
delphidelphi-12-athens

In what unit can I find TDateRec in Delphi?


I'm trying to use TDateRec in Delphi, but I can't find the unit.

I found TDateRec on docwiki where it explained Structured Types.

Whenever I try to use it, I get an error:

[dcc64 Error] E2003 Undeclared identifier: 'TDateRec'

I'm trying to use it as follow:

const
  Date1:TDateRec=(Year:2009;month:05;day:11);

Where can I find TDateRec so that Delphi knows about it when I use it?


Solution

  • Turns out that TDateRec doesn't exist in Delphi. So it can't be found anywhere.

    So what I was trying to do would never have worked. Do achieve what I was trying to do, I would need to create my own record such as:

    type
       TDateRec = record
         Year: Integer;
         Month: 1..12;
         Day: 1..31;
       end;
    

    And then the following code would be possible:

    Date1: TDateRec = (Year:2009;month:05;day:11);