dates when saving to mysql database
- by Patrick
in my php code I was asking the user to choose day, month and year from some dropdown fields where values where 1, 2, 3 etc instead of 01, 02, 03.
these were then combined to form a string like "YYYY-MM-DD" for the insertion in a db (in a date field).
Having missed the initial 0, I thought I was sending strings in the wrong format, eg "YYYY-M-D" or YYYY-MM-D", but then I've noticed they appear in the right format in the database anyway: even if I submitted YYYY-M-D, it appeared as YYYY-MM-DD.
is this the normal behaviour of mysql? if so, can i just avoid worrying about changing the code in my application?