Jump to content

help with date display


sofia403

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.