How to get the current date and time in PHP

The time would pass by your server time. A simple workaround for this is to physically set the timezone by utilizing date_default_timezone_set before the date() or time() capacities are called to.

<?php
$timezone
= date_default_timezone_get(); echo "The current server timezone is: ". $timezone;?>
<?php
echo "The current server timezone is: ". $timezone;
?>