WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to get “echo date” to use wordpress database time?

[Resolved] How to get “echo date” to use wordpress database time?

  • I’m using the php “echo date” to display the current time and date on my blog, which works good, only the time displayed is different from my wordpress time (I dunno if it’s UTC or whatever but it isn’t UTC+9, Japanese time, like the rest of my blog is).

    I tried and use “date_default_timezone_set” but for some reason, it gave me an error: “Fatal error: Call to undefined function: date_default_timezone_set()”

    This is the code I was using

    <?php
    echo date_default_timezone_set('Asia/Tokyo');
    ?>
    <?php echo date ('l'); ?><br>
    <?php echo date ('F d'); ?> <br>
    <?php echo date ('h:i A'); ?>

    All I want to do is to make sure the time and date displayed are Japanese standard time. Any help would be much appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hmm it seems I only have PHP 4.4.7 installed… I guess that’s the problem then?

    Anybody knows any other way of changing the output from the echo date function?

    I realized the time isn’t UTC, but probably the server’s time (located in the US). I don’t know if this makes any difference, but…

    I resolved it by asking my host to install PHP 5, thanks anyway

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] How to get “echo date” to use wordpress database time?’ is closed to new replies.
Skip to toolbar