0

I am very much new to delphi and i tried the following code

procedure TForm1.Button1Click(Sender: TObject);
var
  myDate : TDateTime;
  day    : string;

begin
  myDate := EncodeDate(2002, 12, 31);

  day := LongDayNames[DayOfWeek(myDate)];

  ShowMessage('Christmas day 2002 is on a '+day);
end;

I have declared System.SysUtils in Uses section but still i am getting the error Undeclared identifier.

I am using Delphi XE3 17.0

Jeeva
  • 4,585
  • 2
  • 32
  • 56

1 Answers1

6

In XE2 LongDayNames moved to TFormatSettings. http://docwiki.embarcadero.com/Libraries/XE2/en/System.SysUtils.TFormatSettings.

So you could use:

day := FormatSettings.LongDayNames[DayOfWeek(myDate)];

FormatSettings is a not threadsafe global variable.

How to use it a intended you can see here

Remko
  • 7,214
  • 2
  • 32
  • 52
bummi
  • 27,123
  • 14
  • 62
  • 101
  • my code is scattered with `{$IFDEF DELPHI15}` directives. where is DELPHI15 defined and what is the value for it? – Jeeva Dec 24 '12 at 09:46
  • AFAIK only VERxxx is official http://stackoverflow.com/questions/1369191/what-is-the-compiler-version-for-delphi-2010, here I can find an example for a implementaion with DELPHI15, but might differ from INC to INC http://trac.xananews.techtips.com.br/browser/trunk/components/LowLevel/Source/CompVers.inc – bummi Dec 24 '12 at 10:10
  • Delphi Jedi also uses DELPHIxx defines so you could use that include file – Remko Dec 24 '12 at 10:42