use strict; my $timediff=0; # set it to whatever # just get the month my $month = (localtime(time + ($timediff * 3600)))[4]; # move 0..11 month range into line with human convention $month = sprintf("%02d", ++$month); print ("$month\n");