Get current date and time in PHP

The time would go by your server time. An easy workaround for this is to manually set the timezone before the date() or time() functions are called to.

I’m in Melbourne, Australia so I have something like this:


Or another example is LA – US:


You can also see what timezone the server is currently in via:


So something like:

$timezone = date_default_timezone_get();
echo "The current server timezone is: ". $timezone;

So the short answer for your question would be:

// Change the line below to your timezone!
$date = date('m/d/Y h:i:s a', time());

Then all the times would be to the timezone you just set 🙂

Be the first to comment

Leave a Reply

Your email address will not be published.