我们的计算机设置的区域语言是韩语,我的问题是当我使用 FormatDateTime('MMM DD YYYY') 时,它返回韩语日期(月)。甚至日期日历也不是英语。有什么建议吗?
最佳答案
FormatDateTime 有一个重载变体,您可以使用它来覆盖格式设置:
function FormatDateTime(const Format: string; DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload;
其中 TFormatSettings 定义为:
type
TFormatSettings = record
CurrencyFormat: Byte;
NegCurrFormat: Byte;
ThousandSeparator: Char;
DecimalSeparator: Char;
CurrencyDecimals: Byte;
DateSeparator: Char;
TimeSeparator: Char;
ListSeparator: Char;
CurrencyString: string;
ShortDateFormat: string;
LongDateFormat: string;
TimeAMString: string;
TimePMString: string;
ShortTimeFormat: string;
LongTimeFormat: string;
ShortMonthNames: array[1..12] of string;
LongMonthNames: array[1..12] of string;
ShortDayNames: array[1..7] of string;
LongDayNames: array[1..7] of string;
TwoDigitYearCenturyWindow: Word;
end;
TFormatSettings 几乎可以被所有格式函数使用。
您可以使用(在 Windows 上)获取给定区域设置的格式设置。或者您可以自己创建它。
procedure GetLocaleFormatSettings(LCID: Integer;
var FormatSettings: TFormatSettings);
一切都在 SysUtils 中。
您可以在 this site 上找到 LCID .
关于delphi - 当默认语言为非英语时,如何使用 TDateCalendar 作为英语(日期字幕)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4623035/