Describes how to use the Date () function in PHP. We want to compile the first PHP function Date () to get the current time code :? Phpecho $ showtimedate (Y-m-dH: I: s );? Display format: year-month-day hour: minute: second 2, PHP5 PH we want to write in
I. PHP function Date () to get the current time
Code:
- php echo $showtime=date("Y-m-d H:i:s");?>
Format: year-month-day hour: minute: Second
II. solution to the eight-hour time difference obtained by The PHP function Date () in PHP5
You only need to add a definition before the output Time: date_default_timezone_set ("PRC");, code:
- php
- date_default_timezone_set("PRC");
- echo date("Y-m-d H:i:s");
- ?>
The above is the related knowledge about the PHP function Date (). I hope it will be helpful to you.
Lifecycle 1. PHP function Date () to get the current time code :? Php echo $ showtime = date ("Y-m-dH: I: s ");? Display format: year-month-day hour: minute: second 2, PHP5 in PH...