PDA

View Full Version : Get day, week, and year using Perl


Matt
01-27-2002, 05:03 AM
For anyone looking how to get/ print the day, week, month, and/ or year in Perl, here's the code:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
use Date::Calc qw( Today Day_of_Week );

($year,$month,$day) = Today();
print $month."-".$day."-".$year;

# EOF

For additional information, check out:
Rich's post here: http://www.aota.net/forums/showthread.php?s=&threadid=2581
And the Date::Calc information here: http://www.perldoc.com/perl5.005_03/lib/Date/Calc.html

-Matt