in reply to Getting system time in a specific format

my ($sec,$min,$hour,$day,$mon,$year,@rest) = localtime(time); ++$mon; $year += 1900; printf "%02d%02d%04d\n", $mon, $day, $year;

Note however that the string of digits thus produced can be ambiguous out of context. If you have a degree of control over the format you'd be better to use YYYY-MM-DD or YYYYMMDD.

True laziness is hard work

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.