note 107229 deleted from function.date by tularis

From: Date: Fri, 20 Jan 2012 17:35:43 +0000
Subject: note 107229 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185702@lists.php.net to get a copy of this message
Note Submitter: muhammadhu dot aiman at gmail dot com Reason: bad code ---- add or minus the values that differ from the current php time.the example below makes my php time equals to my system/local time. <?php //my system/local/real current time is 23:50:00 //echo date('H:i:s');and php current time its 19:49:00 //so i added 4 HOURS,1 MINUTE function currentTimeofMine(){ //current php hour (24hrs format with leading 0) $c_h=date('H'); //current php minute (with leading 0) $c_i=date('i'); //current php second $c_s=date('s'); //added 4 hrs $h=$c_h+4; //added 1 mins $m=$c_i+1; //added 5 secs $s=$c_s+5; return $h.':'.$m.':'.$s; } echo date('H:i:s'); //this will echo '19:49:00' echo currentTimeofMine(); //this will echo '23:50:00' ?>

« previous php.notes (#185702) next »