title: Inserting date value into MySQL
body: <p>I currently have a form which takes a date in the format m/d/y - I have then attempted to insert it into a table, but the value in the table reads 0000-00-00. I understand that the value is not being inserted due to the format of the date being inserted.</p>
  
  <p>The problem is, I am unsure on how to change the format so that it is inserted in a format that MySQL will store. </p>
  
  <p>Below is the function that inserts the data into the table:</p>
  
  <pre><code>public function addUser($array) {
    $array['password'] = $this-&gt;hashPassword($array['password']);
    $implodeArray = '"'.implode( '","', $array ).'"';
    $sql = ('INSERT INTO user
                (email, password, firstName, lastName, officeID, departmentID, managerID, roleID, username, contractType, startDate, endDate, totalLeaveEntitlement, remainingLeave) 
             VALUES 
                ('.$implodeArray.')');
    echo $sql;
    die();
    mysql_query($sql,$this-&gt;_db) or die(mysql_error());
    mysql_close();
  }
  </code></pre>
  
  <p>Due to the use of implodeArray, I cannot format the value of startDate and endDate to match the MySQL DATE format. </p>