Date and time
1.UNIX time Stamp
Greenwich Mean Time as a 32-bit integer
This unix timestamp integer is the number of seconds from January 1, 1970 0:0 0 seconds (computer-based) to now
Function: Convenient for us to calculate and use (participate in calculation)
2. Get the date and time in PHP
Time () returns the current UNIX timestamp
GETDATE () Get Date/time information The return value is an associative array
Gettimeofday () Gets the current time
Date_sunrise () returns the Sunrise time for a given date and place
Date_sunset () returns the sunset time for a given date and place
3. Formatted output of date and time
Date () format a local time/date
4. Turn the date and time into a UNIX timestamp
Mktime () timestamp of date obtained
5. Modify the PHP default time zone
Date.timezone= in the php.ini
You can set the time zone with the Date_default_timezone_set () function
6. Use a subtle calculation of the time the PHP script executes
<?PHP//time () returns the current UNIX timestampEcho Time()." <br> ";Echo"<pre>";Print_r(getdate());Echo"</pre><br>";Echo Date("Y-m-d h:i:s", Time())." <br> ";Echo Date("Y-m-d h:i:s"). " <br> ";Echo Mktime()." <br> ";//Set the default time zone to use. Available from PHP 5.1Date_default_timezone_set ("PRC");Echo Date("Y-m-d h:i:s"). " <br> ";?>
Date and time in PHP