#!/usr/bin/perl -wT
use CGI':standard';
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
my @srv_time;
my @gmt;
my $element;
my $utc;
my $servertime;
@srv_time = localtime();
@gmt = gmtime();
print "Content-type: text/html\n\n";
print "<!DOCTYPE html>";
print "<html><head><title>Day and Time Functions</title></head>";
print "<body>";
print "<div style='font-family:monospace;color:#000000;white-space:pre;font-size:26px;'>Sec Min Hr Date Mth Yr Wkd Yrd DST</div>";
print "<div style='font-family:monospace;color:#0000cc;white-space:pre;font-size:26px;'>";
foreach $element (@srv_time)
{
print "$element ";
}
print "==> Server Time</div>";
print "<div style='font-family:monospace;color:#006600;white-space:pre;font-size:26px;'>";
foreach $element (@gmt)
{
print "$element ";
}
print "==> Greenwich Mean Time</div>";
$servertime = localtime();
print "<div style='color:#cc0000;font-size:36px;margin-top:12px;'>Current Server Time: ";
print $servertime;
print "</div>";
$utc = gmtime();
print "<div style='color:#cc0000;font-size:36px;margin-top:12px;'>Current GMT: ";
print $utc;
print "</div>";
print "</body></html>";
Day and Time FunctionsSec Min Hr Date Mth Yr Wkd Yrd DST
26 46 10 21 11 124 6 355 0 ==> Server Time
26 46 16 21 11 124 6 355 0 ==> Greenwich Mean Time
Current Server Time: Sat Dec 21 10:46:26 2024
Current GMT: Sat Dec 21 16:46:26 2024