The MU forums have moved to

Display local time (using GMT offset of blog) (1 post)

  1. pumpkinpatch
    Posted 15 years ago #

    This is for a plugin that I want to modify.
    I do this to get the GMT offset of a particular blog:
    $sql_get_gmtoffset = "SELECT option_value FROM " . $this->db->prefix . $blog_ID . "options WHERE option_name = 'gmt_offset'";
    $gmt_offset_for_this_blog = $this->db->get_results($sql_get_gmtoffset, OBJECT);

    But how do I integrate the GMT offset into my time display
    date("h:i:s A", strtotime($get_time->message_time_date));
    without using a plugin or adding something to the htaccess file? I'm pretty sure it is commonly used, but a lot of searching still hasn't gotten me anywhere.
    I guess I have to add $gmt_offset_for_this_blog to strtotime(), but can't get it work...
    What should I be doing?

About this Topic

  • Started 15 years ago by pumpkinpatch