Show empty field if content is "00.00.0000"

Issue

How can I pass "datetime" to the database with "NULL". So that "0000-00-00 00:00:00" is not displayed as value.

The sql column is not nullable. The value must be "1000-01-01 00:00:00" so that nothing is displayed in the frontend.

How can I do this via PHP

'ERSCHEINUNGSDATUM'     => array(
create_field_info(TABLE_VD_ART, 'erscheinungsdatum', 'vd_date_to_xtc_date')
),

Solution

The solution was to tackle the "function" of "vd_date_to_xtc_date".

function vd_date_to_xtc_date($input_date, $input_format = 'd.m.Y', $output_format = 'Y-m-d', $add_seconds = 0) {
    if (!$input_date)
    {
        return "1000-01-01 00:00:00";
    }
....

Answered By – itsme.vitali

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published