Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
type TDateTime = type Double;
function DayOfTheWeek(Date: TDateTime): word;
Returns the day of the week for a given TDateTime value.
DayOfTheWeek returns an integer between 1 and 7, where Monday is the first day of the week and Sunday is the seventh.
DayOfTheWeek is compliant with the ISO 8601 standard.
const Days: array[1..7] of string =
'Friday', 'Saturday', 'Sunday')
ShowMessage('Today is ' + Days[DayOfTheWeek(Date)]);
//Today is Friday
Free Delphi code snippet inside every Delphi Newsletter!|
Got some code to share? Got a question? Need some help?|