in reply to Re: 3 days previous Date
in thread 3 days previous Date

I used like this in my one of the script
#!/usr/bin/perl sub _timestamp { my $diff = shift; my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time - $di +ff); $mon++; return sprintf("%d-%02d-%02d",($year + 1900),$mon,$mday); } $pre=259200; # 24*60*3 $myTimeStamp = _timestamp ($pre); print "$myTimeStamp \n";
bharat

Replies are listed 'Best First'.
Re^3: 3 days previous Date
by ikegami (Patriarch) on Jun 16, 2010 at 05:34 UTC

    Aside from

    $pre=24*60*60*3;
    being much clearer than
    $pre=259200; # 24*60*3

    not every day has 24*60*60 seconds. Your code is buggy.