02
03 // Day shift: 09:00 to 21:00
04 // Night shift: 21:00 to 09:00
05
06 date_default_timezone_set('PRC'); //Set the time zone, PRC means China •••
07 $hour = date('H');
08 if($hour 8){
09 echo 'Day shift';
10 }else{
11 echo 'night shift';
12 }
13 ?>
1
So what is the difference between PHP implementation and JS implementation?
2
JS gets the client time (that is, the time of your computer), while PHP gets the server time (the most standard, but if the time zones of the two places are different, it will Blockhouse)
http://www.bkjia.com/PHPjc/477866.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477866.htmlTechArticleinput name=riqi class=Wdate type=text id=riqi value=?=date(Y-m-d)? size= / 02 ?php 03 // Day shift: 09:00 to 21:00 04 // Night shift: 21:00 to 09:00 05 06 date_default_timezone_set(...