1, Date_default_timezone_set ("PRC");// Set default time zone
$t = time ();
Echo $t;
$d = Date("Y year M D Day H:i:s", $t);//Thedata function formats the timestamp as a more readable date and time.
Echo $d;
Display as: 14,646,786,492,016 May 31 15:10:49
2, Microtime the (true) function returns the current Unix timestamp and the number of microseconds.
$t 1 = microtime (true);
// ... Execute code ...
$t 2 = Microtime (true);
Echo ' time-consuming '. Round ($t 2-$t 1,3). ' Seconds ';
3, Strtotime () function to parse the datetime description of any English text into a UNIX timestamp
echo Date (' y-m-d h:i:s ', Strtotime (' Now ') +8*60*60);
Result: 2013-04-05 03:15:02
Gets the timestamp of the current time!
4, Mktime () function returns the Unix timestamp of a date
echo Date ("M-d-y", mktime (0, 0, 0, 12, 32,1997));
Display as: jan-01-1998
This article is from the "Linux Warden" blog, so be sure to keep this source http://sswqzx.blog.51cto.com/2494644/1968863
PHP series (eight) PHP date time