If we want to write 1. PHP function Date() to get the current time
Code:
<ol class="dp-xml"><li class="alt"> <span><strong><font color="#006699"><span class="tag"><?</SPAN><SPAN class=tag-name>php</SPAN></FONT></STRONG><SPAN> echo $</SPAN><SPAN class=attribute><FONT color=#ff0000>showtime</FONT></SPAN><SPAN>=</SPAN><SPAN class=attribute-value><FONT color=#0000ff>date</FONT></SPAN><SPAN>("Y-m-d H:i:s");</SPAN><SPAN class=tag><STRONG><FONT color=#006699>?></span></font></strong></span><span> </span> </li></ol>
Display format: year-month-day hour: minute: second
2. Solution to the problem of obtaining time difference of 8 hours with PHP function Date() in PHP5
Just add a definition before the output time: date_default_timezone_set("PRC");, code:
<ol class="dp-xml"><li class="alt"> <span><strong><font color="#006699"><span class="tag"><?</SPAN><SPAN class=tag-name>php</SPAN></FONT></STRONG><SPAN> </SPAN></SPAN><LI class=""><SPAN>date_default_timezone_set("PRC"); </SPAN><LI class=alt><SPAN>echo date("Y-m-d H:i:s"); </SPAN><LI class=""><SPAN></SPAN><SPAN class=tag><STRONG><FONT color=#006699>?></span></font></strong></span><span> </span> </li></ol>
The above is the relevant knowledge we have introduced about the PHP function Date() , hope it helps everyone.