FormatSettings.ShortDateFormat 与系统区域设置不同

FormatSettings.ShortDateFormat not the same as System Locale

我通过以下方式获取当前格式设置:

 _FormatSettings := TFormatSettings.Create(GetThreadLocale);

我的系统短日期格式是 dd.MM.yyyy_FormatSettings.shorDateFormatdd/MM/yyyy。我应该用 FormatSettings 日期分隔符替换斜线还是我不知道其他东西?

我正在使用 Windows 10 和最新更新。

我实际的短日期格式是:

不,您不应该替换 TFormatSettings.ShortDateFormat 中的斜杠。这可能会削弱日期的制定。

TFormatSettings.ShortDateFormat 中的 '/' 字符是 实际日期分隔符 (TFormatSettings.DateSeparator) 的占位符,将在制定期间插入日期字符串。

参考。

procedure DateTimeToString(var Result: string; const Format: string; DateTime: TDateTime; const AFormatSettings: TFormatSettings);

在System.SysUtils