How to use TDateCalendar as English (days of signatures) when the default language is not English?

our computer settings have the regional language Korean, my problem is that when I use FormatDateTime ("MMM DD YYYY"), it returns the date in Korean (month). and even datecalendar is not English. any suggestion?

+4
source share
1 answer

FormatDateTime has an overloaded version that can be used to override format settings:

function FormatDateTime(const Format: string; DateTime: TDateTime; const FormatSettings: TFormatSettings): string; overload; 

Where TFormatSettings is defined as:

 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 can be used by almost all format functions.

You can get the format settings for this language using (on Windows). Or you can create it yourself.

 procedure GetLocaleFormatSettings(LCID: Integer; var FormatSettings: TFormatSettings); 

Everything in SysUtils.

And you can find the LCID on this site .

+2
source

Source: https://habr.com/ru/post/1334627/


All Articles