Hi there,

When I try to get the date, I use getdate() function as below:


$today = getdate();
...
<td>
<?php echo ($today['year']."-".$today['mon']."-".$today['mday']."&nbsp".$today['hours'].":".$today['minutes']); ?>
</td>

The date is fine. But the time is not my local time. For example, now is 17:49pm in Hong Kong, and the script shows me $today['hours'] = 9 😕
I wonder where the date and time coming from! Shall I do something like localize stuff?

Thx.

    It would be coming from the server the function is running on. What does [man]date/man say? +0800?

      I am running the Apache in my machine. So, the time should be the same as my computer...😕

      Running the date('O') shows +0000. It is correct?

        Got it.
        I need to set the php.ini:

        [Date]
        ; Defines the default timezone used by the date functions
        date.timezone = Asia/Taipei
        
          Write a Reply...