• I noticed that WordPress wrongly calculated time, so I investigated a bit.

    Here is an issue:

    When I set TimeZone to Europe/Belgrade WordPress shows different time than when it is set to TimeZone UTC +2. Problemis that is THE SAME TImeZone.

    When WP is set to TimeZone UTC +2 it shows:

    Universal time (UTC) is 2018-10-19 15:01:10. Local time is 2018-10-19 17:01:10.

    When WP is set to TimeZone Europe/Belgrade it shows:

    Universal time (UTC) is 2018-10-19 17:01:10. Local time is 2018-10-19 19:01:10.

    Setting TimeZone on server level (using .htaccess) with SetEnv TZ Europe/Belgrade does not change that behavour.

Viewing 1 replies (of 1 total)
  • Dion

    (@diondesigns)

    WordPress was created before PHP 5.1 added timezone support, and has never been updated to use unix tiemstamps. WordPress still uses “datetime” fields in the database, so it is forced to store two date fields since one cannot assume the MySQL internal timezone is the same as the PHP internal timezone.

    That means if a plugin or theme resets the timezone from UTC using date_default_timezone_set(), WordPress will display times incorrectly — exactly as you described.

Viewing 1 replies (of 1 total)
  • The topic ‘Strange issue with setting TimeZone’ is closed to new replies.