On Wed, 14 Nov 2001 07:21, Robert Miller wrote:
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.
It is documented for mktime - it says '...it will automatically calculate
the correct value for out of rnage input' and the examples include one
where the month value is 13 (at least in my older docs).
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Smile... people will wonder what you've been up to.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]