summaryrefslogtreecommitdiff
path: root/fpcdocs/datutex/ex57.pp
blob: 187f347217b66980ca0c6c7463c34903317f7ede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Program Example57;

{ This program demonstrates the WeeksBetween function }

Uses SysUtils,DateUtils;

Procedure Test(ANow,AThen : TDateTime);

begin
 Write('Number of weeks between ');
 Write(DateToStr(AThen),' and ',DateToStr(ANow));
 Writeln(' : ',WeeksBetween(ANow,AThen));
end;

Var
  D1,D2 : TDateTime;

Begin
  D1:=Today;
  D2:=Today-7;
  Test(D1,D2);
  D2:=Today-8;
  Test(D1,D2);
  D2:=Today-14;
  Test(D1,D2);
  D2:=Today-35;
  Test(D1,D2);
  D2:=Today-36;
  Test(D1,D2);
  D2:=Today-17;
  Test(D1,D2);
End.