Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LongDayNames - originally in SysUtils

Moving from Delphi XE to XE5.

Label1.Caption:= 'Today''s day is '+LongDayNames[DayOfWeek(Date)];

'LongDayNames' no longer works. I see that Delphi put these in my uses:

System.SysUtils, System.Variants, System.Classes,

How do I find 'LongDayNames' so it works?

like image 214
user3470296 Avatar asked Mar 27 '14 20:03

user3470296


1 Answers

You use the values contained in the SysUtils.FormatSettings global variable:

Label1.Caption := SysUtils.FormatSettings.LongDayNames[DayOfWeek(Date)]; 

This allows them to be localized based on the current Windows locale.

Note that use of the global SysUtils.FormatSettings is not thread-safe. To create a thread-safe copy of the format settings, create a local copy of TFormatSettings using TFormatSettings.Create as described in the documentation here instead.

like image 122
Ken White Avatar answered Oct 16 '22 11:10

Ken White