Standard 6.x install, current on all modules except cck/views (I am 1 rev back on those, I tried updating those and the site won't render... skipping that for now, reverted back)

Drupal knows I am in the PST TZ, Apache/PHP agree, and my OS thinks so too... they all have the correct time, and it is set in the Date and Time such that it shows the correct time...

I post something, and it says
"Submitted by schettino on September 11, 2008 - 2:50am"
Cool, except it was posted @7:50 PM on the 10th - the time is +7 hours....

If I check the content recent post list, it knows how to do time DELTAs...
"Blog entry Drupal death spiral schettino 0 21 min 30 sec ago"

Any ideas?

Comments

Oblivious-1’s picture

Do you have user specific time zones enabled? If so, is your personal time zone setting correct in your account settings?
--
Erik
https://twitter.com/erik_smith

schettj’s picture

No I do not. Time is displayed wrong if not logged in, if logged in as super user, or as regular user.

schettj’s picture

Well, this is weird.

I took a look at includes/common.inc where the format_date function lives. Every place that computes the time in that function uses gmdate(), which returns the date in GMT - ie, it ignores your timezone setting.

Changing that to date() fixed all the dates just fine.

    if (strpos('AaDlM', $c) !== FALSE) {
      //$date .= t(gmdate($c, $timestamp), array(), $langcode);
      $date .= t(date($c, $timestamp), array(), $langcode);
    }
    else if ($c == 'F') {
      // Special treatment for long month names: May is both an abbreviation
      // and a full month name in English, but other languages have
      // different abbreviations.
      //$date .= trim(t('!long-month-name '. gmdate($c, $timestamp), array('!long-month-name' => ''), $langcode));
      $date .= trim(t('!long-month-name '. date($c, $timestamp), array('!long-month-name' => ''), $langcode));
    }
    else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== FALSE) {
      //$date .= gmdate($c, $timestamp);
      $date .= date($c, $timestamp);
    }

It's 5:25am local time for me now (don't ask!)
Now I'm getting...

"Recent Posts" list: Blog entry	Drupal death spiral 	schettino	0	9 hours 31 min ago
"Node render": Submitted by schettino on September 10, 2008 - 7:50pm

Which is perfect.

This can't be a bug. Why are they using gmdate() to render the date, thus ignoring the timezone setting???

The Id on my copy of includes/common.inc is
// $Id: common.inc,v 1.756.2.24 2008/08/13 23:59:12 drumm Exp $
Should I file a bug report?

schettj’s picture

No joy after all. That fixed the dates on previously submitted items. New items come up behind in time instead of ahead of time, unless I change the date/time setting to be +0000 in the admin section. It's almost as if the timezone is being applied twice, somehow/somewhere - once when the item is saved (ie, the timestamp is converted to a local time) and then again when it is rendered... I give up.