Skip to content

Instantly share code, notes, and snippets.

@notacouch
Last active December 18, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notacouch/5716514 to your computer and use it in GitHub Desktop.
Save notacouch/5716514 to your computer and use it in GitHub Desktop.
EE 2.6.1 Time tests

Server's timezone is in UTC or GMT w/o DST, +1 w/ DST. [server_timezone]

Organization is NYC-based, or EST, or GMT - 5 w/o DST, -4 w/ DST. [default_site_timezone]

DST is currently on.

The database structure of column field_dt_# is of type varchar(8).

Conclusion:

Test 1

With:

server_timezone         => Europe/London
server_offset           =>
default_site_timezone   => 
honor_entry_dst         => y
time_reference          => local // 'local' vs 'gmt', neither make a difference in this case

Entry Date:

2013-06-05 08:00 AM Localized

Result:

(prints out on screen as 8am)
1370415600
field_dt_#              => 
GMT: Wed, 05 Jun 2013 07:00:00 GMT
Your time zone: 6/5/2013 3:00:00 AM GMT-4

Change Localized to Fixed:

(same value but it prints out on screen as 7am)
field_dt_#              => Europe/L

Revert and change default_site_timezone to America/New_York:

Before saving:

(same value but it prints out on screen as 3am)

After saving:

(same value but it prints out on screen as 3am)

Change Localized to Fixed:

(same value but it prints out on screen as 7am)
field_dt_#              => America/

Save again:

1370430000
GMT: Wed, 05 Jun 2013 11:00:00 GMT
Your time zone: 6/5/2013 7:00:00 AM GMT-4

and again:

1370444400
GMT: Wed, 05 Jun 2013 15:00:00 GMT
Your time zone: 6/5/2013 11:00:00 AM GMT-4

Change default_site_timezone to UM5 and save Entry as 2013-06-05 08:00 AM Fixed:

1370433600
field_dt_#              => UM5
GMT: Wed, 05 Jun 2013 12:00:00 GMT
Your time zone: 6/5/2013 8:00:00 AM GMT-4

Save again and again no changes.

Change Fixed back to Localized (still 8am):

(same value, same print)
field_dt_#              => 

Save again and again and it doesn't change.

Test 2

With:

server_timezone         => UTC
server_offset           =>
default_site_timezone   => 
honor_entry_dst         => y
time_reference          => gmt

Entry Date:

2013-06-05 08:00 AM Localized

Result:

1370419200
field_dt_#              => 
GMT: Wed, 05 Jun 2013 08:00:00 GMT
Your time zone: 6/5/2013 4:00:00 AM GMT-4

Change Localized to Fixed:

(same value, same print)
field_dt_#              => UTC

Change default_site_timezone to UM5 and Fixed to Localized:

1370433600 (same print)
field_dt_#              => 
GMT: Wed, 05 Jun 2013 12:00:00 GMT
Your time zone: 6/5/2013 8:00:00 AM GMT-4

Change Localized back to Fixed:

(same value, same print)
field_dt_#              => UM5

Change default_site_timezone to UM4 and Fixed to Localized:

1370430000 (same print)
field_dt_#              => 
GMT: Wed, 05 Jun 2013 11:00:00 GMT
Your time zone: 6/5/2013 7:00:00 AM GMT-4

The entry still says 2013-06-05 08:00 AM:

  • it saved the value according to UM4 but is displaying according to UM5.
  • perhaps the save is backend reference and print is clientside

Changed to UM3 and saved but same exact values and print. It looks as if default_site_timezone is not used at but if we omit it it prints 11am, and back to UM5 we get 7am, UM2 is 9am, UM1 is 11am, UTC is 11am, UP1 is 1pm. So localization is more complicated than just +/- hours, probably has to do with DST observations, e.g. Europe/London is UTC, but UTC+1 (UP1) in the summer time (BST). Either that or something is wrong.

honor_entry_dst doesn't seem to do anything.

Omitting all related values from the bootstrap and saving Localization settings from the CP as United Kingdom London

WITHOUT Bootstrap:

server_timezone         => Europe/London
server_offset           =>
default_site_timezone   => 
honor_entry_dst         => y
time_reference          => local
tz_country              => gb // this has been this way the whole time, EE will write it to your config.php if not found.

Entry Date:

2013-06-05 08:00 AM Localized

Result:

1370415600
field_dt_#              => 
GMT: Wed, 05 Jun 2013 07:00:00 GMT
Your time zone: 6/5/2013 3:00:00 AM GMT-4

Change Localized to Fixed and saving repeatedly regresses an hour every time b/c field_dt_# does not have the full timezone, just Europe/L. If you set server_timezone to UTC that will work just fine, however, Localization Settings screen won't autoselect the dropdown values accordingly. Then again if you're using a bootstrap config that isn't config.php itself you should be alright as the CP settings will not override yours (however if you're using config.php it may save over it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment