The general way to do "time math" is to convert to epoch seconds, do math in seconds and then convert back to a string.
Except it doesn't work. Not all days have 24*60*60 seconds.
the OP's idea of adding zero is a GREAT idea.
And POSIX's strftime is the way to do it if you're already dealing with localtime or gmtime (It handles the y+1900 and the m+1 for you.)
use POSIX qw( strftime ); print( strftime('%Y%m%d', localtime), "\n");
In reply to Re^2: Date Time problem.
by ikegami
in thread Date Time problem.
by Karger78
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |