Re: php-db Digest 18 Mar 2002 18:40:25 -0000 Issue 1105

From: Date: Tue, 19 Mar 2002 07:10:18 +0000
Subject: Re: php-db Digest 18 Mar 2002 18:40:25 -0000 Issue 1105
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17758@lists.php.net to get a copy of this message
At 06:40 PM 3/18/2002 +0000, you wrote:
Subject: How to add 2 years to todays date ? Hi All I think the subject line says it all. How to add 2 years to today's date ? Any helps as always most appreciated. Dave Carrera Php Developer Subject: Re: [PHP-DB] How to add 2 years to todays date ? In php $your_timestamp += gmmktime(0,0,0,1,1,1972); MySQL has INTERVALling options. Regards, Andrey Subject: RE: [PHP-DB] increase date() Try this: $six_months_from_now = date("Y-m-d", mktime(0,0,0, date(m)+6, date(1), date(Y))); echo "Six Months From Now: $six_months_from_now<P>";
In my coding, I've used:
        $date_var=date("Y-m-d",strtotime("+0 days"));
In your case, you could do it like:
        $date_var=date("Y-m-d", strtotime("+2 years"))
or
        $date_var=date("Y-m-d H:i", strtotime("+2 years"))
if you wanted hours/minutes either example formats in a way that MySQL wants to see a date or datetime field (respectively) hope it helps, ~ Rob Small c0demonkey Fresno, CA

« previous php.db (#17758) next »