level 7
Delphi syntax:
function DateTimeToStr(DateTime: TDateTime): string; overload;
function DateTimeToStr(DateTime: TDateTime; const FormatSettings: TFormatSettings): string; overload;
C++ syntax:
extern PACKAGE AnsiString __fastcall DateTimeToStr(const System::TDateTime DateTime);
extern PACKAGE AnsiString __fastcall DateTimeToStr(const System::TDateTime DateTime, const TFormatSettings FormatSettings);
Description
The first form of DateTimeToStr is not thread-safe, because it uses localization information contained in global variables. The second form of DateTimeToStr, which is thread-safe, refers to localization information contained in the FormatSettings parameter. Before calling the thread-safe form of DateTimeToStr, you must populate FormatSettings with localization information. To populate FormatSettings with a set of default locale values, call GetLocaleFormatSettings.这个是Delphi自带的开发文档,我也没看见有这种用法的啊。
也就是说DateTimeToStr重载只有2种,一种是你的S[3]调用情况,对应的是function DateTimeToStr(DateTime: TDateTime): string; overload;
第二种情况,我自己也没有用过,但是根据开发文档显示TFormatSettings并不是string类型的。
2015年01月05日 01点01分
3
原来是这样,那请问TFormatSettings是什么类型?在这里怎么用,能否举个例子?
2015年01月05日 04点01分
回复 cushaw95 :在Delphi 7选中TFormatSettings按住Ctrl + F1。
2015年01月05日 07点01分