Store incomplete date in MySQL date field

前端 未结 3 1460
孤街浪徒
孤街浪徒 2020-12-28 16:13

I want to offer the user the possibility to introduce dates that are incomplete (for example just the year 2005, or Jan 1998) but also complete dates with year, month, day.

3条回答
  •  情话喂你
    2020-12-28 16:36

    Storing parts of dates depends on the sql mode MySQL is running in. Please read http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html, especially about invalid dates in http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html#sqlmode_allow_invalid_dates.

提交回复
热议问题