Answers.Body: <p>I have discovered that if I change the timezone for my Drupal user account to 'Europe/Sofia' then I no longer get this error message.</p>
  
  <p>This solves the problem, but not in a very satisfactory way as I'm based in the UK and would like the timezone for my user to reflect this.</p>
  
  <p>It appears that CiviCRM creates this error message if your Drupal user account isn't in the same timezone as the database server. </p>
  
  <p>I'm still not sure if this actually causes any real problems.  See my related post: <a href="https://civicrm.stackexchange.com/questions/7586/does-the-timestamp-mismatch-error-cause-any-real-problems?lq=1">Does the &#39;timestamp mismatch&#39; error cause any real problems?</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-10T11:09:34.480Z
Answers.LastActivityDate: 2015-12-10T11:09:34.480Z
Answers.LastEditDate: 2017-04-13T12:53:13.167Z
Answers.UserDisplayName: William Mortada
Answers.Body: <p>I have flagged a similar problem with Joomla as an issue a long time ago and submitted some code to solve it:</p>
  
  <p><a href="https://issues.civicrm.org/jira/browse/CRM-15656" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-15656</a></p>
  
  <p>The CiviCRM team reckon it will be fixed in 4.7.7.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-20T15:33:01.447Z
Answers.Text: That's great!  I hope that fixes this problem.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-22T09:29:05.060Z
Answers.Text: Wiliam - I just switched to CiviHosting and have run across the same problem - also in the UK.  However, it doesn't seem to create a problem - so far that is...  Did you ever find a fix for this?
Answers.UserDisplayName: Andy Clark
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-22T21:03:22.253Z
Answers.Text: @AndyClark Not really, other than to change the user's timezone to match - see https://civicrm.stackexchange.com/a/8222/127.  However I'm not sure if it actually causes any problems.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-20T15:16:12.037Z
Answers.LastActivityDate: 2016-04-20T15:16:12.037Z
Answers.UserDisplayName: Stephen Palmstrom
Answers.Body: <p>check what's the timezone under /admin/config/regional/settings, drupal can overwrite the php default timezone</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-14T21:04:53.910Z
Answers.Text: Changing the timezone for the user does seem to fix this problem (though not in a satisfactory way).  See my answer below for details.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T13:26:33.260Z
Answers.Text: Thanks. I have tried changing that but it doesn't appear to make any difference. Also the organisation is based in the UK so want London to be the timezone for users.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-08T09:52:46.327Z
Answers.LastActivityDate: 2015-11-08T09:52:46.327Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>This is one possible solution.</p>
  
  <p><a href="https://beta.suresupport.com/faq/article-1568/en/setting_mysql_session_time_zone" rel="nofollow">https://beta.suresupport.com/faq/article-1568/en/setting_mysql_session_time_zone</a></p>
  
  <p>Another is setting the 'timezone' property in php.ini or .htaccess file, or in civicrm.settings.php or drupal's settings.php</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-10T13:10:13.733Z
Answers.Text: Looking at the source code for CiviCRM it looks like it sets the MySQL timezone as part of the initialisation process anyhow. (See setMySQLTimeZone() function in CRM/Utils/System/Base.php)
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T13:29:57.307Z
Answers.Text: Thanks for the link but I'm not clear how I could use this. Are you suggesting I edit the core CiviCRM files?
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T13:30:46.163Z
Answers.Text: As mentioned in my question I have edited the php.ini file.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-09T00:24:19.287Z
Answers.LastActivityDate: 2015-11-09T00:24:19.287Z
Answers.UserDisplayName: CiviTeacher
Answers.Body: <p>As an experiment, I edited your CRM/Utils/System/Base.php file and changed:</p>
  
  <pre><code>      $sql = "SET time_zone = '$timeZoneOffset'";
  </code></pre>
  
  <p>to</p>
  
  <pre><code>      $sql = "SET time_zone = 'Europe/London'";
  </code></pre>
  
  <p>and that seems to have fixed the problem. This is certainly not the ideal solution, but it does work.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-09T17:31:57.727Z
Answers.Text: Unfortunately that doesn't help.  I still get the same error when I log in.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-09T15:23:14.357Z
Answers.LastActivityDate: 2015-12-09T15:23:14.357Z
Answers.UserDisplayName: Hershel
Body: <p>Every time I log in to CiviCRM I get the following error message:</p>
  
  <blockquote>
    <p>Timestamps reported by MySQL (eg "2015-11-06 13:44") and PHP (eg "2015-11-06 11:44" ) are mismatched.</p>
  </blockquote>
  
  <p>I am using CiviCRM 4.6.10 and Drupal 7.41.  </p>
  
  <p>The host (CiviHosting) has said that the MySQL server timezone is set to "Europe/Sofia" and can't be changed.</p>
  
  <p>I have set the PHP timezone via php.ini to match this:</p>
  
  <pre><code>date.timezone = "Europe/Sofia"
  </code></pre>
  
  <p>However, I am still getting this error message.</p>
  
  <p>The date section of phpinfo shows the following:</p>
  
  <pre><code>date/time support   enabled
  "Olson" Timezone Database Version   2013.3
  Timezone Database   internal
  Default timezone    Europe/London
  
  Directive   Local Value Master Value
  date.default_latitude   31.7667 31.7667
  date.default_longitude  35.2333 35.2333
  date.sunrise_zenith 90.583333   90.583333
  date.sunset_zenith  90.583333   90.583333
  date.timezone   Europe/Sofia    Europe/Sofia
  </code></pre>
  
  <p>(Note that the 'Default timezone' is different to the 'date.timezone'.)</p>
  
  <p>Any idea how I can fix this?</p>
  
  <p>Thanks for your help.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-09T15:46:52.273Z
Comments.Text: Similar: *[Why is CiviCRM not seeing the timezone correctly?](http://civicrm.stackexchange.com/questions/2721)*
Comments.UserDisplayName: choster
Tags: <drupal><mysql><php><timezone>
Title: Timestamp mismatch between MySQL and PHP
ThreadText: # Timestamp mismatch between MySQL and PHP
  
  (Asked by: username_0 on 2015-11-06)
  
  Every time I log in to CiviCRM I get the following error message:
  
  Timestamps reported by MySQL (eg "2015-11-06 13:44") and PHP (eg "2015-11-06 11:44" ) are mismatched.
  
  I am using CiviCRM 4.6.10 and Drupal 7.41.  
  The host (CiviHosting) has said that the MySQL server timezone is set to "Europe/Sofia" and can't be changed.
  I have set the PHP timezone via php.ini to match this:
  date.timezone = "Europe/Sofia"
  
  However, I am still getting this error message.
  The date section of phpinfo shows the following:
  date/time support   enabled
  "Olson" Timezone Database Version   2013.3
  Timezone Database   internal
  Default timezone    Europe/London
  
  Directive   Local Value Master Value
  date.default_latitude   31.7667 31.7667
  date.default_longitude  35.2333 35.2333
  date.sunrise_zenith 90.583333   90.583333
  date.sunset_zenith  90.583333   90.583333
  date.timezone   Europe/Sofia    Europe/Sofia
  
  (Note that the 'Default timezone' is different to the 'date.timezone'.)
  Any idea how I can fix this?
  Thanks for your help.
  
  **Tags:** drupal, mysql, php, timezone
  
  > **Comments:**
  > **username_1**: Similar: *[Why is CiviCRM not seeing the timezone correctly?](http://civicrm.stackexchange.com/questions/2721)*  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_0 on 2015-12-10. Score: 1 | Accepted answer
  
  I have discovered that if I change the timezone for my Drupal user account to 'Europe/Sofia' then I no longer get this error message.
  
  This solves the problem, but not in a very satisfactory way as I'm based in the UK and would like the timezone for my user to reflect this.
  
  It appears that CiviCRM creates this error message if your Drupal user account isn't in the same timezone as the database server.
  
  I'm still not sure if this actually causes any real problems. See my related post: [Does the 'timestamp mismatch' error cause any real problems?](https://civicrm.stackexchange.com/questions/7586/does-the-timestamp-mismatch-error-cause-any-real-problems?lq=1)
  
  
  ---
  
  ### Answer by username_2 on 2016-04-20. Score: 2
  
  I have flagged a similar problem with Joomla as an issue a long time ago and submitted some code to solve it:
  
  <https://issues.civicrm.org/jira/browse/CRM-15656>
  
  The CiviCRM team reckon it will be fixed in 4.7.7.
  
  > **Comments:**
  > **username_0**: That's great!  I hope that fixes this problem.  
  > **username_3**: Wiliam - I just switched to CiviHosting and have run across the same problem - also in the UK.  However, it doesn't seem to create a problem - so far that is...  Did you ever find a fix for this?  
  > **username_0**: @AndyClark Not really, other than to change the user's timezone to match - see https://civicrm.stackexchange.com/a/8222/127.  However I'm not sure if it actually causes any problems.  
  
  ---
  
  ### Answer by username_4 on 2015-11-08. Score: 1
  
  check what's the timezone under /admin/config/regional/settings, drupal can overwrite the php default timezone
  
  > **Comments:**
  > **username_0**: Thanks. I have tried changing that but it doesn't appear to make any difference. Also the organisation is based in the UK so want London to be the timezone for users.  
  > **username_0**: Changing the timezone for the user does seem to fix this problem (though not in a satisfactory way).  See my answer below for details.  
  
  ---
  
  ### Answer by username_5 on 2015-11-09. Score: 1
  
  This is one possible solution.
  
  <https://beta.suresupport.com/faq/article-1568/en/setting_mysql_session_time_zone>
  
  Another is setting the 'timezone' property in php.ini or .htaccess file, or in civicrm.settings.php or drupal's settings.php
  
  > **Comments:**
  > **username_0**: Thanks for the link but I'm not clear how I could use this. Are you suggesting I edit the core CiviCRM files?  
  > **username_0**: As mentioned in my question I have edited the php.ini file.  
  > **username_0**: Looking at the source code for CiviCRM it looks like it sets the MySQL timezone as part of the initialisation process anyhow. (See setMySQLTimeZone() function in CRM/Utils/System/Base.php)  
  
  ---
  
  ### Answer by username_6 on 2015-12-09. Score: 1
  
  As an experiment, I edited your CRM/Utils/System/Base.php file and changed:
        $sql = "SET time_zone = '$timeZoneOffset'";
  
  to
        $sql = "SET time_zone = 'Europe/London'";
  
  and that seems to have fixed the problem. This is certainly not the ideal solution, but it does work.
  
  > **Comments:**
  > **username_0**: Unfortunately that doesn't help.  I still get the same error when I log in.  
  
  ---
  
  