> -----Original Message-----
> From: John Clarke [mailto:[EMAIL PROTECTED]]
> Sent: 20 March 2002 00:40
>
> I have used the following script successfully for a year now,
> but have just
> found a problem with the date 2002-03-31.
>
> Any ideas why this would be happening?
>
> function addDays($date,$nofdays) {
> $dd=strtotime($date);
> $dd2=$dd + (3600*24*$nofdays);
> return date("Y-m-d", $dd2);
> }
> $nd=addDays("2002-03-31","2");
> echo $nd
This will be, indeed, an issue with the daylight-saving time transition which, at
least hereabouts, occurs on 31-March/2002.
But, since you're using strtotime anyway, why don't you just use its relative offset
capabilities to do your conversion:
function addDays($date,$nofdays) {
$dd2 = strtotime("+$nofdays days", $date);
return date("Y-m-d", $dd2);
}
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php