Fred,
  I don't know if this will help, but I have this code that figures out what
yesterday's date is. It should be relatively simple to change it to two days
ago. I am sure that there are easier ways to do it, but this has been
working for me for a long time. The only two caveats are that I didn't
design it to handle leap years and that I don't know if it will work after
the year 2100.

                                                Wes


%days_in_month=(
        'January' => '31',
        'February' => '28',
        'March' => '31',
        'April' => '30',
        'May' => '31',
        'June' => '30',
        'July' => '31',
        'August' => '31',
        'September' => '30',
        'October' => '31',
        'November' => '30',
        'December' => '31'
);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
@month=qw(January February March April May June July August September
October November December);
#
if ($year < 100) {                               #This removes the "1" on
the year, if there.
   $nyear=$year;
} else {
  $nyear=$year - 100;
}
if ($mday > 1) {                                         #This takes care of
the beginning of the month
  $tempday=$mday - 1;                    #and year.
  $tempmon=$mon + 1;
  $tempyear=$nyear;
  if ($tempday < 10) {
         $yesterday="0$tempday";
  } else {
         $yesterday=$tempday;
  }
  if ($tempyear < 10) {
         $lastyear="0$tempyear";
  } else {
         $lastyear=$tempyear;
  }
  if ($tempmon < 10) {
         $lastmon="0$tempmon";
  } else {
         $lastmon=$tempmon;
  }
} elsif ($mon > 1) {
  $lastmon=$mon;
  $tempmon=$mon;
  $yesterday=$days_in_month{$month[$lastmon]};
  $tempyear=$nyear;
  if ($tempyear < 10) {
         $lastyear="0$tempyear";
  } else {
         $lastyear=$tempyear;
  }
  if ($tempmon < 10) {
         $lastmon="0$tempmon";
  } else {
         $lastmon=$tempmon;
  }
} else {
  $tempyear=$nyear - 1;
  $lastmon=12; 
  $yesterday=$days_in_month{'December'};
  if ($tempyear < 10) {
         $lastyear="0$tempyear";
  } else {
         $lastyear=$tempyear;
  }
}   




-----Original Message-----
From: Fred Sahakian [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 25, 2001 5:53 PM
Subject: Date


Im Stuck!

I need to figure out how to covert a date such as 10242001 into Epoch time
or another format where as I can subtract 2 calendar dates and get a number.

thanks

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

Reply via email to