Mega Code Archive

 
Categories / Delphi / Variables
 

Shortdaynames - an array of days of the week names, starting 1 = sunday

var ShortDayNames : array[1..7] of string; array[1] := 'Sun'; array[2] := 'Mon'; array[3] := 'Tue'; array[4] := 'Wed'; array[5] := 'Thu'; array[6] := 'Fri'; array[7] := 'Sat'; Description The ShortDayNames variable provides an array of short string names of the days of the week. Since it is an array, you can update the default values (set by the Windows locale), but this is not advised. Notes Warning : these values use Sun as the starting value. This is not ISO 8601 compliant. Use with DayOfWeek, which also treats Sunday as the first day of the week. You are advised to use DayOfTheWeek which is ISO 8601 compliant, using Monday as the start of the week. Related commands LongDayNames An array of days of the week names, starting 1 = Sunday LongMonthNames An array of days of the month names, starting 1 = January ShortMonthNames An array of days of the month names, starting 1 = Jan Example code : Show the day of the week for Christmas 2002 var myDate : TDateTime; day : string; begin myDate := EncodeDate(2002, 12, 31); day := ShortDayNames[DayOfWeek(myDate)]; ShowMessage('Christmas day 2002 is on a '+day); end; Show full unit code Christmas day 2002 is on a Tue