use POSIX qw(strftime); $now = time; $then = $now - 15 * 60; # 15 minutes ago; print map strftime("%Y%m%d%H%M%S\n", localtime($_)), $now, $then;