与DateSeparator和LongTimeFormat相关的未声明的标识符错误 [英] Undeclared Identifier errors related to DateSeparator and LongTimeFormat

查看:94
本文介绍了与DateSeparator和LongTimeFormat相关的未声明的标识符错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Delphi 5创建的程序,该程序在Win7和Win8上仍然可以完美运行。

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

但是,当尝试在XE6中运行此代码时(试用版)我遇到两个错误,无法修复。错误出现在 DateSeparator和 LongTimeFormat上,每个都有未声明的标识符错误。

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"

代码段如下:

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

我对Delphi很陌生,但是我很确定未声明的标识符是指该项目在代码中未事先确定。如果是这种情况,我不知道如何实现。也许,错误与Delphi 5以来的代码格式更改有关。

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.

推荐答案

使用 FormatSettings.DateSeparator 而不是 DateSeparator

这篇关于与DateSeparator和LongTimeFormat相关的未声明的标识符错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆