WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to get "echo date" to use wordpress database time? (4 posts)

  1. sailormarcus
    Member
    Posted 7 years ago #

    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!

  2. sailormarcus
    Member
    Posted 7 years ago #

    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?

  3. sailormarcus
    Member
    Posted 7 years ago #

    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...

  4. sailormarcus
    Member
    Posted 7 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic