+ Added ex 13-ex 19

This commit is contained in:
michael 1999-05-13 07:49:08 +00:00
parent ada18d4b27
commit 2164fb72d9
8 changed files with 126 additions and 0 deletions

View File

@ -12,3 +12,11 @@ ex9.pp contains an example of the DecodeDate function.
ex10.pp contains an example of the DecodeTime function.
ex11.pp contains an example of the EncodeDate function.
ex12.pp contains an example of the EncodeTime function.
ex13.pp contains an example of the FileDateToDateTime function.
ex14.pp contains an example of the FormatDateTime function.
ex14.pp contains an example of the FormatDateTime function.
ex15.pp contains an example of the IncMonth function.
ex16.pp contains an example of the IsLeapYear function.
ex17.pp contains an example of the MSecsToTimeStamp function.
ex18.pp contains an example of the Now function.
ex19.pp contains an example of the StrToDate function.

14
docs/sysutex/ex13.pp Normal file
View File

@ -0,0 +1,14 @@
Program Example13;
{ This program demonstrates the FileDateToDateTime function }
Uses sysutils;
Var
ThisAge : Longint;
Begin
Write ('ex13.pp created on :');
ThisAge:=FileAge('ex13.pp');
Writeln (DateTimeToStr(FileDateToDateTime(ThisAge)));
End.

14
docs/sysutex/ex14.pp Normal file
View File

@ -0,0 +1,14 @@
Program Example14;
{ This program demonstrates the FormatDateTime function }
Uses sysutils;
Var ThisMoment : TDateTime;
Begin
ThisMoment:=Now;
Writeln ('Now : ',FormatDateTime('hh:mm',ThisMoment));
Writeln ('Now : ',FormatDateTime('DD MM YYYY',ThisMoment));
Writeln ('Now : ',FormatDateTime('c',ThisMoment));
End.

18
docs/sysutex/ex15.pp Normal file
View File

@ -0,0 +1,18 @@
Program Example15;
{ This program demonstrates the IncMonth function }
Uses sysutils;
Var ThisDay : TDateTime;
Begin
ThisDay:=Date;
Writeln ('ThisDay : ',DateToStr(ThisDay));
Writeln ('6 months ago :',DateToStr(IncMonth(ThisDay,-6)));
Writeln ('6 months from now :' ,DateToStr(IncMonth(ThisDay,6)));
Writeln ('12 months ago :',DateToStr(IncMonth(ThisDay,-12)));
Writeln ('12 months from now :' ,DateToStr(IncMonth(ThisDay,12)));
Writeln ('18 months ago :',DateToStr(IncMonth(ThisDay,-18)));
Writeln ('18 months from now :' ,DateToStr(IncMonth(ThisDay,18)));
End.

23
docs/sysutex/ex16.pp Normal file
View File

@ -0,0 +1,23 @@
Program Example16;
{ This program demonstrates the IsLeapYear function }
Uses sysutils;
Var YY,MM,dd : Word;
Procedure TestYear (Y : Word);
begin
Writeln (Y,' is leap year : ',IsLeapYear(Y));
end;
Begin
DeCodeDate(Date,YY,mm,dd);
TestYear(yy);
TestYear(2000);
TestYear(1900);
TestYear(1600);
TestYear(1992);
TestYear(1995);
End.

20
docs/sysutex/ex17.pp Normal file
View File

@ -0,0 +1,20 @@
Program Example17;
{ This program demonstrates the MSecsToTimeStamp function }
Uses sysutils;
Var MS : Comp;
TS : TTimeStamp;
DT : TDateTime;
Begin
TS:=DateTimeToTimeStamp(Now);
Writeln ('Now in days since 1/1/0001 : ',TS.Date);
Writeln ('Now in millisecs since midnight : ',TS.Time);
MS:=TimeStampToMSecs(TS);
Writeln ('Now in millisecs since 1/1/0001 : ',MS);
MS:=MS-1000*3600*2;
TS:=MSecsToTimeStamp(MS);
DT:=TimeStampToDateTime(TS);
Writeln ('Now minus 1 day : ',DateTimeToStr(DT));
End.

9
docs/sysutex/ex18.pp Normal file
View File

@ -0,0 +1,9 @@
Program Example18;
{ This program demonstrates the Now function }
Uses sysutils;
Begin
Writeln ('Now : ',DateTimeToStr(Now));
End.

20
docs/sysutex/ex19.pp Normal file
View File

@ -0,0 +1,20 @@
Program Example19;
{ This program demonstrates the StrToDate function }
Uses sysutils;
Procedure TestStr (S : String);
begin
Writeln (S,' : ',DateToStr(StrToDate(S)));
end;
Begin
Writeln ('ShortDateFormat ',ShortDateFormat);
TestStr(DateTimeToStr(Date));
TestStr('05/05/1999');
TestStr('5/5');
TestStr('5');
End.