Use php to get the implementation code of server time

  • 2020-06-07 04:08:40
  • OfStack

Many times we like to use js to get dates and times, but that's just the client side.
We can use php's date function to get the time on the server:

<?php
// Set the time zone to China 
date_default_timezone_set("PRC");
echo date("Y-m-d l H:i:s A");
// Example output: 2010-03-06 Saturday 11:51:29 AM
?>


Related articles: