perl -MTime::Local=timelocal -e 'print scalar localtime timelocal qw(30 40 2 15 8 2012)'; #### #!/usr/bin/perl -l use strict; use autodie; use warnings; use POSIX 'strftime'; use Time::Local 'timelocal'; my $days_ago = '48'; ($days_ago) = strftime("%d", gmtime( time - $days_ago * 86400 )); print scalar localtime timelocal( 30, 40, 2, $days_ago, 7, 2012, );