note 48939 added to function.checkdate

From: Date: Wed, 12 Jan 2005 14:26:26 +0000
Subject: note 48939 added to function.checkdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-83143@lists.php.net to get a copy of this message
Example for sum a day to the actual date, using an hour limit. For example in this case when the time will be over 17:00 hrs the program will sum a day to the actual data. <?php $horaq = date('H'); print $horaq."<br>"; $anoq = date('Y'); $mesq = date('m'); $diaq = date('d'); $fechaq = $diaq."/".$mesq."/".$anoq; print $fechaq; if ($horaq>=17) { $diaq = $diaq + 1; if (strlen($diaq)==1) { $diaq = "0".$diaq; } if(checkdate ($mesq,$diaq,$anoq)){ print "<br>".$diaq."/".$mesq."/".$anoq; }else{ $diaq = "01"; $mesq = $mesq + 1; if (strlen($mesq)==1) { $mesq = "0".$mesq; } if (checkdate ($mesq,$diaq,$anoq)) { print "<br>".$diaq."/".$mesq."/".$anoq; } else { $mesq = "01"; $anoq = $anoq + 1; print "<br>".$diaq."/".$mesq."/".$anoq; } } } ---- Manual Page -- http://www.php.net/manual/en/function.checkdate.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48939 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48939&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48939&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48939&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48939&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48939&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48939&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48939&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83143) next »