Bill Akins wrote:
> ...
> Try this:
> #!/usr/bin/perl -w
> 
> my @now     = localtime;
> my $sec     = ( $now[0] );
> my $min     = ( $now[1] );
> my $hr      = ( $now[2] );
> my $day     = ( $now[3] );
> my $mth     = ( $now[4] + 1 );
> my $yr      = ( $now[5] + 1900 );
> 
> $day = ($day -1);
> print "Yesterday was $mth/$day/$yr\nor if on the other side
> of the pond, $day/$mth/$yr\n";

What if today is the first of the month?

Better to use something like:

   ($d, $m, $y) = (localtime(time - 86_400))[3..5];
   $m++;
   $y += 1900;

IOW, have the system calculate local time for current epoch - 86,400
seconds (# of seconds in a day).

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to