==== #!/usr/bin/env perl #use 5.012; use strict; use warnings; use DateTime; use Time::Local; my $dt = DateTime->new(year => 2016, month => 1, day => 1); print "DateTIme confirms that 01-01-2016 was a => " . $dt->day_name . "\n"; print "DateTime return the Week no for 01-01-2016 => " . $dt->week . "\n"; $dt = DateTime->new(year => 2016, month => 1, day => 4); print "DateTIme confirms that 04-01-2016 was a => " . $dt->day_name . "\n"; print "DateTime return the Week no for 04-01-2016 => " . $dt->week . "\n"; my ($MONTHDAY, $WEEKDAY, $YEARDAY) = (localtime (timelocal(0,0,0,1,0,2016)))[3,6,7]; my $WEEKNUM = int($YEARDAY / 7) + 1; print "using localtime to calculate weekno (01/01/2016) => " . $WEEKNUM . "\n"; ($MONTHDAY, $WEEKDAY, $YEARDAY) = (localtime (timelocal(0,0,0,4,0,2016)))[3,6,7]; $WEEKNUM = int($YEARDAY / 7) + 1; print "using localtime to calculate weekno (04/01/2016) => " . $WEEKNUM . "\n"; print "UNIX system cal command output for 1st month \n"; system("cal -w 1 2016"); ===