Pascal date and time function() To Calculate Date,Hours,Minutes and Seconds - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Saturday, September 23, 2017

Pascal date and time function() To Calculate Date,Hours,Minutes and Seconds

Write an  Pascal Program For  date and time function() To Calculate Date

Program:
Program DatenTimeDemo;
uses sysutils;
var
year, month, day, hr, min, sec, ms: Word;

begin
writeln ('Date and Time at the time of writing : ',DateTimeToStr(Now));
writeln('Today is ',LongDayNames[DayOfWeek(Date)]);
writeln;
writeln('Details of Date: ');

DecodeDate(Date,year,month,day);
writeln (Format ('Day: %d',[day]));
writeln (Format ('Month: %d',[month]));
writeln (Format ('Year: %d',[year]));
writeln;
writeln('Details of Time: ');

DecodeTime(Time,hr, min, sec, ms);
writeln (format('Hour: %d:',[hr]));
writeln (format('Minutes: %d:',[min]));
writeln (format('Seconds: %d:',[sec]));
writeln (format('Milliseconds: %d:',[hr]));
end.

Output:
Date and Time at the time of writing : 7/24/2012 8:26:
Today is Tuesday
Details of Date:
Day:24
Month:7
Year: 2012
Details of Time:
Hour: 8
Minutes: 26
Seconds: 21

Milliseconds: 8

No comments:

Post a Comment