RE: [PHP] Re: [PHP-DB] How to add 2 years to todays date ?
| From: | Ford, Mike [LSS] | Date: | Mon, 18 Mar 2002 12:51:33 +0000 |
| Subject: | RE: [PHP] Re: [PHP-DB] How to add 2 years to todays date ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-88916@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Andrey Hristov [mailto:ahristov@icygen.com]
> Sent: 18 March 2002 08:20
>
> $your_timestamp+=gmmktime(0,0,0,1,1,1972);
Well, that depends on your definition of "year" -- the problem here is that it makes no
allowances for leap years, so (for example) 2-mar-2003 would be converted to 1-mar-2005 (since
29-feb-2004 would be effectively "lost").
Both the other solutions offered would cope with this, but personally I like the strtotime("+2
years") one best!
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: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211