MySQL Dates
The most difficult part when working with dates is to be sure that the format of the date you are trying to insert, matches the format of the date column in the database.
As long as your data contains only the date portion, your queries will work as expected. However, if a time portion is involved, it gets more complicated.
MySQL Date Data Types
MySQL comes with the following data types for storing a date or a date/time value in the database:
DATE
– format YYYY-MM-DDDATETIME
– format: YYYY-MM-DD HH:MI:SSTIMESTAMP
– format: YYYY-MM-DD HH:MI:SSYEAR
– format YYYY or YY
Note: The date data type are set for a column when you create a new table in your database!