2

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.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
Brent
  • 55
  • 1
  • 7
  • 2
    http://stackoverflow.com/q/25109497 and http://stackoverflow.com/q/14018365 should help, as would a quick search of the help file using "LongTimeFormat", which clearly finds [this documentation](http://docwiki.embarcadero.com/Libraries/XE6/en/System.SysUtils.TFormatSettings.LongTimeFormat) that shows the location. (The documentation on [Global Variables](http://docwiki.embarcadero.com/RADStudio/XE6/en/Global_Variables) explains the location change and why it was done.) – Ken White Aug 05 '14 at 03:14
  • Welcome to Stack Overflow, Brent. The edits you've made to your question indicate that the problem described here has been resolved. If solving that problem has lead to other compilation errors in other units, then that's a completely unrelated problem. Please don't use this question to post updates about unrelated problems. I've rolled back the edits to accurately reflect your original question. Please feel free to post a new question if you have further trouble. – Rob Kennedy Aug 05 '14 at 16:43
  • Hi Rob. Thanks for your note and I understand your roll back. It was not my intention to create a new problem from old problem. It was a complete guess to use "FormatSettings." with the LongTimeFormat error too. Doing so, seems to be spared a debugging error but that still does not mean it will work. I was asking if this solution should work with my original question. – Brent Aug 05 '14 at 17:06
  • Ken, I appreciate your suggestions. I am looking into your links to better understand this all. – Brent Aug 05 '14 at 17:08

1 Answers1

7

use FormatSettings.DateSeparator instead of DateSeparator

kutsoff
  • 325
  • 2
  • 7
  • Thanks. This works. Following this lead, I also used FormatSettings.LongTimeFormat instead of LongTimeFormat which seems to pass debugging. – Brent Aug 05 '14 at 16:55