Jump to content

Last Friday of each month: Difference between revisions

m
Line 2,905:
=={{header|Pascal}}==
{{works with|Free Pascal}}
Using theFree Pascal's DateUtils library includedwould with Free Pascal woulddramatically simplify the coding (see the Delphi example) but for older Pascal implementations the needed routines are the programmer's responsibility!.
<lang Pascal>
program LastFriday;
Line 2,973:
d := DaysInMonth(m, y);
w := DayOfWeek(m, d, y);
{ findback immediatelyup prioras occuranceneeded ofto weekdaydesired kweekday }
if w >= k then
dLastWeekday := d - (ord(w) - ord(k))
else
dLastWeekday := d - (7 - ord(k)) - ord(w);
LastWeekday := d;
end;
 
211

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.