summaryrefslogtreecommitdiff
path: root/fpcdocs/datutex/ex106.pp
blob: 951fedca236f3371b58d9dee1019b547deef1362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Program Example105;

{ This program demonstrates the DecodeDayOfWeekInMonth function }

Uses SysUtils,DateUtils;

Var
  Y,M,NDoW,DoW : Word;
  D : TDateTime;
Begin
  DecodeDayOfWeekInMonth(Date,Y,M,NDoW,DoW);
  If TryEncodeDayOfWeekInMonth(Y,M,NDoW,DoW,D) then
    begin
    Write(DateToStr(D),' is the ',NDow,'-th ');
    Writeln(formatdateTime('dddd',D),' of the month.');
    end
  else
    Writeln('Invalid year/month/NthDayOfweek combination');
End.