How to show default local time zone of Philippines?

How can I show the local date and time for Philippines?

<? php date_default_timezone_set('Asia/Manila'); echo "<span style='color:red;font-weight:bold;'>Date: </span>". date('F j, Y g:i:a ');
?>
3

2 Answers

You shouldn't add space between <? and php

<?php
date_default_timezone_set('Asia/Manila');
echo "<span style='color:red;font-weight:bold;'>Date: </span>". date('F j, Y g:i:a ');
?>
4

As @worldask already sad you shouldn't add space between those <? php . The rest of the code is good. The reason why you don't get the date you want, is that the server's time is different than you think it is. When the PHP engine adds 8 hours to his system date it gives you a good result. In order to check which is the current hour and debug your problem use the following code, then fix the system's date.

<?php
echo "Current timezone: ".date_default_timezone_get()."</ br> Current time: ".date("d-m-Y H:i:s");
?>
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like