Common PHP library functions: php library functions. Common PHP library functions: php library functions 1. how to obtain the timestamp time () -- The number of milliseconds echotime () calculated from January 1, 1970; date echodate (Y-m-dH: I: s ); obtain common PHP library functions by default.
1. time and date
- How to obtain the timestamp time ()-The number of milliseconds since January 1, 1970
echo time();
echo date('Y-m-d H:i:s');
- Obtain the default time zone
echo date_default_timezone_get();
- The time obtained by default is different from the time on the local computer. you need to set the corresponding time zone.
Date_default_timezone_set ('Asia/Shanghai'); // Set it to the Shanghai time zone echo date ('Y-m-d H: I: s ');
- Converts a timestamp to a date.
echo date('Y-m-d H:i:s',time());echo '
';echo date('Y-m-d H:i:s',time());
Lifecycle 1. how to obtain the timestamp time () -- The number of milliseconds calculated since January 1, 1970 echo time (); date echo date ('Y-m-d H: I: s '); the default value is...