Category : Pascal Source Code
Archive   : MINIGEN.ZIP
Filename : CURTIME.INC

 
Output of file : CURTIME.INC contained in archive : MINIGEN.ZIP


Type
MG_TimeStr = String[10];

Function CurrentTime : MG_TimeStr;
{** Returns the current time in '99:99:99 am/pm' format **}

Const
Am = 'am';
Pm = 'pm';
Var
Hour,Minute,Second,Sec100 : Word;
HStr,MStr,Sstr : String[2];
AmPm : String[2];

Begin
GetTime(Hour,Minute,Second,Sec100);
AmPm := Am;
If Hour = 0 then
Begin
Hour := 12;
AmPm := Pm;
End;
If Hour > 12 then
Begin
Hour := Hour - 12;
AmPm := Pm;
End;
Str(Hour:2,HStr);
If HStr[1] = ' ' then
HStr[1] := '0';
Str(Minute:2,MStr);
If MStr[1] = ' ' then
MStr[1] := '0';
Str(Second:2,SStr);
If SStr[1] = ' ' then
SStr[1] := '0';
CurrentTime := Concat(HStr,':',mStr,':',SStr,AmPm);
End; {CurrentTime}