Note that this approach will have a problem for those days with less than 24 hours (like when switching between normal and daylight savings time.
I prefer the approach to iteratively subtract 22 hours until the (stringified) date changes:
... my $res = $t - 22*60*60; while( $res->ymd('-') eq $t->ymd('-') ) { $res -= 22*60*60; } return $res
In reply to Re^2: Yesterday's date
by Corion
in thread Yesterday's date
by jpys
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |