I have this problem with saving a date into a MySQL database.
I have this input field:
<input type="date" name="theDate" id="theDate" required></p>
Before I save it to the database I format the string to a date like this:
date('Y.m.d', strtotime($table['day']));
The database field is a DATE but it only saves 0000-00-00.
When I echo out the date before saving it, it is correctly 2012-02-23.
I hope anyone can tell me how this is done.
outputs
2012.02.23not2012-02-23… you needSee this section on MySQL Date and Time literals