title: STRING to DATE conversion in UPDATE
body: <p>I want to store a string variable as a date in a DATE type column using this code.</p>
  <pre><code>$affectedRows = $pdo-&gt;exec(&quot;UPDATE `$table_final` SET `Date_B` = $Date_Courant, `Id_SB` = $NoStation&quot;);
  </code></pre>
  <p>where <code>$Date_Courant</code> is defined as the string: <code>2022-07-01</code></p>
  <p>I get this error message:</p>
  <pre><code>( ! ) Fatal error: in C:\Users\Jean Claude\Documents\ADNA06\Développements\FormationWamp\LoadData_Infile_Pics_Temp_Jours_Stations.php on line 116
  ( ! ) PDOException: in C:\Users\Jean Claude\Documents\ADNA06\Développements\FormationWamp\LoadData_Infile_Pics_Temp_Jours_Stations.php on line 116
  
  Call Stack
  1   0.0072  361904  {main}( )   ...\LoadData_Infile_Pics_Temp_Jours_Stations.php:0
  2   0.1586  429024  exec( $query = 'UPDATE `picbruit` SET `Date_B` = (DATE) 2022-07-01, `Id_SB` = 1' )  ...\LoadData_Infile_Pics_Temp_Jours_Stations.php:116
  </code></pre>
  <p>I tried with the CAST instruction as follows: same error message.</p>
  <pre><code>$affectedRows = $pdo-&gt;exec(&quot;UPDATE `$table_final` SET `Date_B` = (DATE) $Date_Courant, `Id_SB` = $NoStation&quot;);
  </code></pre>
  <p>What is the proper way of doing this?</p>