Search code examples
delphidelphi-5delphi-xe6

Undeclared Identifier errors related to DateSeparator and LongTimeFormat


I have a program that was created in Delphi 5 and the program still runs nearly perfect on Win7 and Win8.

However, when trying to run this code in XE6 (trial version) I get two errors that I am having trouble fixing. Errors are with 'DateSeparator' and 'LongTimeFormat' with each having the error "undeclared identifier"

The code segment is as follows:

function AccurateTimeStamp:String;
begin
  DateSeparator:='.';
  LongTimeFormat:='hhmmsszzz';
  result:=TimeToStr(Now);
end;

I am very new to Delphi but I'm pretty sure that "undeclared identifiers" mean's that the item was not identified prior in code. If this is the case, I do not know how to accomplish this. Perhaps, errors are related to a change in code format since Delphi 5.


Solution

  • use FormatSettings.DateSeparator instead of DateSeparator