sofia403 Posted May 25, 2011 Share Posted May 25, 2011 hi, i was wondering if its possible to not have null values in mysql db. at the moment if i enter something in db and dont enter a date it appears as 0000-00-00 . it would be much better if i could have that field as blank. and i also need to keep it in "DATE" format. thank you Quote Link to comment https://forums.phpfreaks.com/topic/237394-help-with-date-display/ Share on other sites More sharing options...
gizmola Posted May 25, 2011 Share Posted May 25, 2011 NULL is the absence of value. It is not recommended because it often does not work the way people expect it to, however you can allow a column to be null when you define it and if you do not supply a value the column will be null which is exactly what you have. DATE columns in mysql use numbers internally and 00-00-0000 is not a valid date in the range of possible dates for a mysql DATE column. You did not say where you are seeing the zeros date, but the display of a date is entirely up to the developer. Dates can be formatted in just about any way you want. It's up to the developer to do the formatting either using mysql functions to format it in the query or with procedural code. Quote Link to comment https://forums.phpfreaks.com/topic/237394-help-with-date-display/#findComment-1219949 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.