1

We built a site for a hospital and they can login to a special admin page where they can update location wait times using exp:channel:form

When they first login, we show the last updated time and the last wait time updated. When I output {current_time} and the entry's {edit_date} inside the channel loop, it's 5 hours off.

When I echo the current time using the PHP date() function, it outputs the current time in the client's time zone (PT).

Screenshot of issue

Running EE v2.7.3

What could be causing the offset in the {current_time} and {edit_date} EE tags? I'm pulling my hair out!

  • Actually I was wrong, looking at the date it's showing last updated 5/28 (yesterday's date) so it's a -19 hour offset not a 5 hour offset. Not sure if that matters much or not. – Brandon Eley May 29 '14 at 18:36
1

After working with EllisLab support on this issue, it turned out to be a rogue config item in the database for "server_offset" config item. It was set to -1140 for some reason.

They were kind enough to decode, unserialize, modify, re-serialize, and re-encode the variable for us and that fixed the problem.

Here's the response regarding the resolution from EE support:

I’ve traced it down to an orphaned server_offset setting that is in your site preferences in the database of -1140. In 2.6.0 the UI for that setting was removed, but the config is still observed as there are rare situations where it’s necessary (server OS time permanently incorrect for instance). It became somewhat of a setting in the ether though without the UI, and without being in the config file. We’ve fixed this in 2.8.0, and it will extract the value from the db if it exists and place it in the config file. For some reason, it would seem that this installation had a server offset setting of -1140 prior to being updated?

In case you are not able to update soon, I’ve just overridden that value in the config.php file with:

$config[‘server_offset’] = ‘0’;

And the times look correct now. After you run the 2.8.0 update down the road, though, it will extract that db value and overwrite that with -1140. At that point you can simply remove that setting entirely from your config file after the update. Make sense?

| improve this answer | |
  • That is a really odd error. Good to know that the EllisLab folks could set you straight. – SamC May 30 '14 at 21:26
0

This might be what you're looking for.

Check your localization settings in the admin panel. Admin => Localization Settings Here's the EE help page about it: http://ellislab.com/expressionengine/user-guide/cp/admin/localization_settings.html

If that's still a pain in your ass, you can force it in the config.php file. See this: http://ellislab.com/expressionengine/user-guide/general/system_configuration_overrides.html#default-site-timezone

But you can also set localization on the user, so check your own settings there, just in case.

| improve this answer | |
  • The localization settings are set to "United States - Los Angeles" -- definitely not a -19 hour difference. Also, I did check the user account by editing as the admin user and double checking that it too was set to Los Angeles. Still same timestamp. – Brandon Eley May 29 '14 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.