• Hi. I hope I am posting this in the correct section. I have found a small snippet of code which displays the current date on my page. The code is:
    // [date]
    function displaydate(){
    return date(‘l, F jS, Y’);
    }
    add_shortcode(‘date’, ‘displaydate’);
    // end date
    This works perfectly on my site https://www.billhughes.co.uk.
    I am not very conversant with php and wondered whether anyone could tell me where the code gets the current time/date from . Does it get local time, wherever you are viewing the page in the world, or does it get its time from the host server (which is in America)? In other words would the date change at the correct time locally for the viewer?

Viewing 4 replies - 1 through 4 (of 4 total)
  • It gets it from the time set on your server. The server time that the site sees is also set by what’s in the ‘Settings -> General’ page in your admin area.

    Thread Starter billh65

    (@billh65)

    Thanks catacaustic. As I said I am not very well up on php. My time is set to London (UK time) in my admin page settings. So will everyone in the world see the date change at midnight UK time?

    Yes they should. You’ll be able to see what time that outputs, so have a look and see that it matches your local time. If it does, then you’ll be fine.

    Thread Starter billh65

    (@billh65)

    Thanks catacaustic, much appreciated

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘display date php code query’ is closed to new replies.