note 104560 deleted from function.mktime by danbrown

From: Date: Thu, 23 Jun 2011 14:26:29 +0000
Subject: note 104560 deleted from function.mktime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-180878@lists.php.net to get a copy of this message
Note Submitter: mcsdodo at ynet dot sk ---- proper way of creating tomorrow dates <?php $DATE = '2011-10-30'; echo $tomorrow = date('Y-m-d',strtotime($DATE)+60*60*24); /*echoes: 2011-10-30 !!! thats WRONG*/ echo $tomorrow = date("Y-m-d", strtotime("+1 day", strtotime($DATE)) ); /*echoes: 2011-10-31*/ $day = date('j',strtotime($DATE)); $month = date('n',strtotime($DATE)); $year = date('Y',strtotime($DATE)); echo $tomorrow = date('Y-m-d',mktime(0,0,0, $month, $day+1, $year)); /*echoes: 2011-10-31*/ ?>

« previous php.notes (#180878) next »