On a MySQL table the Date column is set at YYYY-MM-DD with some dates shown as 0000-00-00
(Default set at NULL) where no date is available. This is OK until I display the web page that contains the php code for the SELECT query.

All the 0000-00-00 dates are displayed on the html page as 1970-01-01.

I have tried in MySQL inserting something like 0 but cannot. Apparently inserting 'blank' is not an option.

I just want to display a blank field or 0000-00-00.
Does this require php or mysql intervention and what exactly ?

Time stamps in mysql are saved in unix time, which is of seconds between the date you specify and 1970-01-01. In your query you can write:

SELECT fieldA, IF(strcmp(fieldB,'0000-00-00'),fieldB,'0') AS 'fieldB' FROM mytable;

bye

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.