in reply to Values of day and month in two digets

I suggest that the call to Data::Calc::Add_Delta_Days is not necessary, as subtracting 86_400 (number of seconds in a day) from time is guaranteed to yield 'yesterday', regardless of the time of day. I use:

#!/usr/bin/perl -w use strict; my ($d, $m, $y) = (localtime (time-86_400)) [3..5]; printf "%04d%02d%02d\n", $y+1900, $m+1, $d;

Replies are listed 'Best First'.
Re: Re: Values of day and month in two digets
by chromatic (Archbishop) on Mar 12, 2004 at 06:42 UTC

    Very little in date or time handling comes with a guarantee. Consider daylight savings time or leap seconds, for example.

      Unix ignores leap-seconds (see time(2)) and (modulo leap-seconds) the time() function always works in UTC.