Undeclared Identifier errors related to DateSeparator and LongTimeFormat [duplicate]

ε祈祈猫儿з 提交于 2020-06-16 07:24:41

问题


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.


回答1:


use FormatSettings.DateSeparator instead of DateSeparator



来源:https://stackoverflow.com/questions/25130578/undeclared-identifier-errors-related-to-dateseparator-and-longtimeformat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!