in reply to Getting 2-digit dates from localtime()
The most common solution to this problem (leading '0' for numbers) is to use sprintf:
$string = sprintf("%02d/%02d/%d", $year, $month, $mday);See the perlfunc manpage (or 'perldoc -f sprintf') for more information on sprintf.
I would be tempted to continue the 'mday' naming convention over 'date' as 'date' usually signifies the entire data structure that represents the date. 'wday' and 'mday' signify only a component of the 'date'.
|
|---|