XBasic3000
XBasic3000

Reputation: 3486

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

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?

Upvotes: 4

Views: 780

Answers (1)

Toon Krijthe
Toon Krijthe

Reputation: 53366

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.

Upvotes: 2

Related Questions