WordPress.org

Forums

[resolved] Weird coding output. Have you seen this? (6 posts)

  1. Eric Mallek
    Member
    Posted 1 year ago #

    Hello out there -
    I am using 3.5.1 with a modified (child) theme of Sliding Door. I'm currently adding code into the footer.php file with a date/time stamp. (working on a local host/MAMP before uploading changes etc...)

    Heres my code
    <?php

    echo date_default_timezone_set('America/Los_Angeles') ;
    echo date('F j g:i a') ;

    ?>

    its returning - 1April 20 7:36 pm

    I can not seem to find out where that extra 1 digit before the month is coming in. I have removed the time zone and it then the digit comes up at the end of the line (after pm)

    Has anyone else experienced this? Its probably an easy fix.... Thanks!

    Eric

  2. Justin
    Member
    Posted 1 year ago #

    You do not need to echo date_default_timezone_set('America/Los_Angeles')

  3. Eric Mallek
    Member
    Posted 1 year ago #

    Yup! That was it. Looks like its back in UTC but ill fix that... I figured it would be easy...Thanks!

  4. Justin
    Member
    Posted 1 year ago #

    No Problem.

  5. Justin
    Member
    Posted 1 year ago #

    One thing. You said the time zone changed back. do you still have the timezone set function there or did you rid it completely.

    Just use

    date_default_timezone_set('America/Los_Angeles') ;

    Without the echo

  6. Eric Mallek
    Member
    Posted 1 year ago #

    yup, took out echo is exactly what I did... Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags