Adding Dates (To Obtain Future Dates)

From: Date: Tue, 13 Nov 2001 20:51:19 +0000
Subject: Adding Dates (To Obtain Future Dates)
Groups: php.general 
Request: Send a blank email to php-general+get-74489@lists.php.net to get a copy of this message
This problem took a while to figure out. I'm posting the solution so that = other's may find this example. If you know of a better way, please reply. = :-) Cheers, Rob Problem: Generate Future Dates: Sub-Problem: Future Dates are Dictated by Record Type (Permanent or = Temporary) The Script: $cyear =3D date("Y"); $cmonth =3D date("m"); $cday =3D date("d"); if ($sType =3D=3D p) { $fyear =3D $cyear + 6 $sExpiry =3D $fyear.$cmonth.$cday; } else { $adv =3D $cmonth + 6; $newunix =3D mktime(0,0,0,$adv,$cmonth,$cyear); $sExpiry =3D date("Ymd", $newunix); } $sCreated =3D date("Ymd"); $sUpdated =3D date("Ymd"); It seems weird to have use months possibly greater than 12 ($adv =3D = $cmonth + 6;), but hey... it works.

« previous php.general (#74489) next »