RE: [PHP] Adding +7 more days on date() value problem

From: Date: Fri, 10 Sep 2004 20:46:39 +0000
Subject: RE: [PHP] Adding +7 more days on date() value problem
Groups: php.general 
Request: Send a blank email to php-general+get-196357@lists.php.net to get a copy of this message
So if this is run on the 30th of the month, you are saying this handles a month with day 37 correctly? Warren Vail -----Original Message----- From: Gryffyn, Trevor [mailto:TGryffyn@air-cargo-inc.com] Sent: Friday, September 10, 2004 11:58 AM To: php-general@lists.php.net Cc: Louie Miranda Subject: RE: [PHP] Adding +7 more days on date() value problem I disagree on the strtotime recommendations that everyone else gave. The mktime() function itself will compensate for leap years, "day = 36" type stuff and all of that. <?php $curdate = date("Y-m-d"); $plus7 = date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y"))); Echo "Current Date: $curdate<br>"; Echo "+7 Dats Date: $plus7"; ?> Simple as that! -TG > -----Original Message----- > From: Louie Miranda [mailto:lmiranda@gmail.com] > Sent: Tuesday, July 27, 2004 11:31 PM > To: php-general@lists.php.net > Subject: [PHP] Adding +7 more days on date() value problem > > > I can't figure how could i add +7 more days on the DD (Day) value. My > problem is, when the day is close on the end of the month like > > 07/29/2004 > > when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar. > And im creating a program below, to explode it and maybe just add +. > But i think its useless if im just going to do + on the DD (Day) > value. > > Hmm :? > > ## > <?php > $curdate = date("Y-m-d"); > $plus7 = explode("-", $curdate); > > print (" > <p>cut: > " .$plus7[0]. " > " .$plus7[1]. " > " .$plus7[2]. " > </p> > > Current Date: $curdate<br> > +7 Dats Date: $plus7 > > "); > ?> > ## > > -- > Louie Miranda > http://www.axishift.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#196357) next »