title: PHP and SQL timezone off
body: <p>I'm trying to fetch data from MySQL database using PHP and everything works fine aside from the date. The date is over a day behind and I just can't figure out how to fix it. I'm using PHPMyAdmin with Apache on my CentOS 8 server PC.</p>
  <p>The date-column on the database has type: <strong>datetime</strong> with default value: <strong>current_timestamp()</strong>.</p>
  <p>I'm using PHP to insert the values onto my database except for the date-column which I was hoping the database would sort out by itself.</p>
  <p>I understand I could either try and change the timezone on MySQL (I couldn't find a way to make this work as the query didn't seem to recognize Europe/Helsinki timezone) or I could just change it on PHP side before it gets displayed on the website but no luck there either.</p>
  <p>Code used to fetch the date: (+ some different time echos)</p>
  <pre class="lang-php prettyprint-override"><code>  date_default_timezone_set('Europe/Helsinki');
    while ($rows = $result-&gt;fetch_assoc()) {
            $currdate = date('Y-m-d H:i:s', time());
    }
    echo $currdate;
    $date = date('Y-m-d H:i:s');
    echo $date;
    $newdate = new DateTime($currdate, new DateTimeZone('Europe/Helsinki'));
    echo $newdate-&gt;format('Y-m-d H:i:s');
    $timestamp = date('H:i d.m.Y', strtotime($rows['date']));
  </code></pre>
  <p>They all print out the same date and time which is</p>
  <blockquote>
  <p>2020-12-06 18:41:53</p>
  </blockquote>
  <p>The current time (as of writing this) should be 2020-12-07 20:04:00 which is over a day behind. And when I try a different timezone like Europe/Paris, the time won't change at all.</p>
  <p>The database currently has some example data so I can delete all records without a problem if it was needed to create a new table with a different default value. Or I could try to insert the date value manually from the PHP script but the problem would still persist as PHP has the timezone all wrong.</p>
  <p>I have no idea where the issue is. I'm somewhat new to this stuff but I have looked this up and tried many different ways I found from here and other sites but no luck. Any ideas?</p>