use Time::Local; use constant ONE_DAY => 24 * 60 * 60; my ($sec,$min,$hour,$mday,$mon,$year) = gmtime(); $mday = 1; my $time = timegm($sec,$min,$hour,$mday,$mon,$year) - ONE_DAY; print "Date: " . localtime($time) . "\n"; $mday = (localtime($time))[3]; print "Day of month: $mday\n";