WordPress.org

Ready to get started?Download WordPress

Forums

Current time displayed (7 posts)

  1. codi
    Member
    Posted 4 years ago #

    I need a snippet of code to display the current time of my location as in 12:01 PM EST. I want to put it in the header of my site next to the search box. I already have the date...also the time but can't get it to show local..only UTC

    Codi

  2. vtxyzzy
    Member
    Posted 4 years ago #

    Can you use the date('g:i A e') function?

  3. codi
    Member
    Posted 4 years ago #

    This is what I have now:

    <?php print(date ('g:i A T')); ?>

    and this is what it shows ast 12:34 PM EST

    4:34 PM UTC

    When I used your snippit it showed

    5:28 PM UTC

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    at te bottom of that page was something about setting timezone, a novice guess from me?

    <?php
    date_default_timezone_set('EST');
    
    echo date('g:i A'); ?>
  5. codi
    Member
    Posted 4 years ago #

    RVoodo....you are the MAN or the LADY as the case may be...that did the trick...Thank you very much. Your having taken the time to assist is greatly appreciated.

    I am slowly putting together this site http://webnewsfeed.com and http://webnewsfeed.com/blog

    All input is greatly accepted.

    Also thanks to vtxyzzy for your effort.

    Thanks again

    Codi

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    sweet! heluva good guess I'd say!

    and MAN is correct....

  7. vtxyzzy
    Member
    Posted 4 years ago #

    Actually, you can set the Timezone in Admin->Settings->General so you don't have to code it in the php.

    Please mark this topic 'Resolved'.

Topic Closed

This topic has been closed to new replies.

About this Topic