IHYPRESS PROGRAMMING
Tutorials and Perl programs with code and output for beginners
Perl logo
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Perl ❯ Date & Time Functions
<05>
#!/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 "==&gt; Server Time</div>"; print "<div style='font-family:monospace;color:#006600;white-space:pre;font-size:26px;'>"; foreach $element (@gmt) { print "$element "; } print "==&gt; 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>";
Hergestellt in Deutschland / Made in Germany
Day and Time Functions
Sec 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
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland