The MU forums have moved to WordPress.org

Wrong timezone when using mysql2date() (2 posts)

  1. trink79
    Member
    Posted 15 years ago #

    I am using mysql2date() to to display when the recently updated blogs were last updated. Problem is, it is displaying the time in UTC timezone even though my blog is set to use UTC -4.

    This is the line of code I am using in my foreach loop
    <?php echo mysql2date(__('F j, g:i a'), $details['last_updated']) ?>

    Is there a way to specify the timezone in there? Does mysql2date() always use UTC?

  2. dsader
    Member
    Posted 15 years ago #

    Try

    $current_offset = get_option('gmt_offset');
    $timestamp = strtotime($details['last_updated']) + $current_offset * 3600;
    echo date_i18n(__('F j, g:i a'), $timestamp);

About this Topic