use POSIX 'strftime'; my $then = time - (14 * 24 * 60 * 60); my $date = strftime ('%Y%m%d', localtime $then); print $date; # prints 20020524 #### use Time::Piece; use Time::Seconds; my $now = localtime; # Now a Time::Piece object my $then = $now - (14 * ONE_DAY); print $then->ymd; # or various other output functions