how to use TDateCalendar as English(Days Captions) when the default language is non English?

StackOverflow https://stackoverflow.com/questions/4623035

Pergunta

our computer settings has regional language is Korean, my problem is when i use FormatDateTime('MMM DD YYYY') it returns the date on Korean language(Month). and even the datecalendar is non English. any suggestion?

Foi útil?

Solução

FormatDateTime has an overloaded variant that you can use to override the 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 of a given locale with (on Windows). Or you can create it yourself.

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

Everything is in SysUtils.

And you can find the LCID on this site.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top