correct date (cont.)

From: Date: Thu, 09 Aug 2001 17:08:33 +0000
Subject: correct date (cont.)
Groups: php.general 
Request: Send a blank email to php-general+get-62017@lists.php.net to get a copy of this message
Oops..(Hit send prematurely.) $currentmonth = date("m"); $currentday = date("d"); $year = date("Y"); $newmonth = $currentmonth + 3; if ($newmonth > 12){ $newmonth = $newmonth % 12; $year = $currentyear + 1; } $3months = date("Y-m-d",mktime(0,0,0,$newmonth,$currentday,$year)); This should get me exactly 3 months later and also checks for if its a later month (oct, nov, or dec) then it goes to the next year. How could I check to see if the new date doesn't fall on Feb. 30th or whatever? If someone signs up on the 31st of a month it'll never end on a month with 31 days. Thanks, Pat

« previous php.general (#62017) next »