Re: 2 dates, difference in days AARGH!!

From: Date: Wed, 11 Dec 2002 20:26:26 +0000
Subject: Re: 2 dates, difference in days AARGH!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127889@lists.php.net to get a copy of this message
I have made those changes, thank you (I even read the integers required thing but for some reason didn't register it). Here is what I have now. Working with Dec 25, 2002 (a difference that should be 14 days). <?$maturity_date = mktime (0,0,0,$mday_row[3],$mday_row[2],$mday_row[5]);?> <?$today = getdate();?> <?$now_date = mktime (0,0,0,$today['mon'],$today['mday'],$today['year']);?> <?$difference_date = ($maturity_date - $now_date);?> <?$difference_days = ($difference_date / 86400);?> difference in days: <?print $difference_days;?> AND IT WORKS!!!! Thank you Chris you have saved, my hairline, my marriage, and my sanity! Chris Wesley wrote:
Oh, and $today['wday'] ... that's the day of the week. I'm almost positive you want the day of the month: $today['mday']. hth,
       ~Chris
On Wed, 11 Dec 2002, Chris Wesley wrote:
On Wed, 11 Dec 2002, Curtis Gordon wrote:
future date: <?$maturity_date = mktime (0,0,0,$mday_row[3],$mday_row[2],$mday_row[5]);?> current date: <?$today = getdate();?> <?$now_date = mktime (0,0,0,$today['month'],$today['wday'],$today['year']);?>
     
$today['month'] is text, ie. "December", and mktime() requires all integer arguments. If you use $today['mon'] instead, it seems like you'll get what you want.
-- Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

« previous php.general (#127889) next »