What is an appropriate value to store in a DATE MySQL variable if only month and year are known? -


suppose have mysql variable date_stored of date datatype. have month , year particularly date data stored in date_stored. no day information given. there guidelines on store in date_stored if month , year known?

mysql manual says partial dates can stored. month , day ranges specifiers begin 0 because mysql permits incomplete dates storing such '2015-00-00' or '2015-10-00'. http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format

so if day part not given can still store yyyy-mm-00 e.g '2015-10-00'

also see below related posts.

store incomplete date in mysql date field

mysql datatype store month , year only

sql datatype - how store year?


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -