in reply to potential date and time issues / code cleanup
Getting the previous day's date is a FAQ. You should find a variety of answers on PM. One way is the following:
# Jan = 1 my ($yest_y, $yest_m, $yest_d) = ( gmtime( timegm(0,0,0,$today_d,$today_m-1,$today_y) - 24*60*60 ) )[5,4,3]; $yest_m += 1; $yest_y += 1900;
Use timegm + gmtime even for local dates.
|
|---|