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

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

문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top