in reply to Re^3: Date Handling in Perl
in thread Date Handling in Perl
Yes, '1 day ago' affects the full date, not just the day. But you get year, month, and day with separate calls - so if you need to get the day again with '1 day ago', you should also get the month and year again with '1 day ago'.
You could get them with one system call:
($y,$m,$d) = split/\s/,`date "+%Y %M %d"`; ($y,$m,$d) = split/\s/,`date -d "1 day ago" "+%Y %M %d"`;
|
|---|