• Please help! I am trying to get the correct time and date to show on my site, this is not about posts.

    I have tried adding 2 different scripts to my child functions file.

    function time_func($atts) {
    extract(shortcode_atts(array(
    ‘timeFormat’ => ‘F j, Y, g:i a’
    ), $atts));
    $thetime = time();
    return date($timeFormat, $thetime);
    }
    add_shortcode(‘time’, ‘time_func’);

    and
    function displaydate(){
    return date(‘F j, Y, g:i a’);
    }
    add_shortcode(‘date’, ‘displaydate’);

    I have added SetEnv TZ location/location to my htaccess file, I have the timezone correct in settings, and I still am getting GMT showing up.

    I am stumped… can anyone help???
    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter mickif

    (@mickif)

    ok, update… adding SetEnv TZ location/location to my htaccess file worked, server showing my local time, which leads me to beleive the other code(s) are incomplete. Anyone know what needs to be added to reflect my local time?

Viewing 1 replies (of 1 total)

The topic ‘Getting correct date and time on site’ is closed to new replies.