[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-users
Subject:    RE: Compare dates question
From:       Thomas_M <Thomas_M () bls ! gov>
Date:       2002-06-26 13:27:22
[Download RAW message or body]

> I like this idea, but the only problem is that it is set to 
> 30 days no 
> matter what. The date 05/27/2002 runs up on 06/26/2002. 
> Exactically 30 days 
> later. I was hoping to set it to the exact date from month to 
> month. Like 
> the start date is 05/27/2002 the end date would be 06/27/2002.

Well, that's not much different, really. Just keep the day before converting
to epoch time.

my ($month,$day,$year) = (5,27,2002);
my $tl_year = $year-1900;
my $tl_mo = $month%12;
$tl_year+=1 unless ($tl_mo);

if (time - timelocal (0,0,0,$day,$tl_mo,$tl_year) > 0) {
	print "Your time is up\n";
} else {
	print "You're OK\n";
}

-- 
Mark Thomas            Thomas_M@bls.gov
   for($r=-1;$r!=38;$c++){print"\n",
      " "x(38-$r+++($c=0))if($c>
           $r);print~$r&$c?
               " `":" #"
                  ;}

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic