Date is not "white" sql-srv

3

I have a column in the database type date .

WhenIchangesomedateinaformphpandleaveitblankthesameinsteadofbeingblankitbringsmebacktodatewith1900-01-01.

BelowistheinputIusetochangethedate.

DateOutput:

<inputtype="date" id="saida" name="saida" value="<?php echo $datasaida; ?>"/>

I think the problem is the bank. Any idea?

    
asked by anonymous 05.04.2016 / 14:49

1 answer

1

When you send an empty field, SQL Server does not understand what you want, so it puts a date by default.

You have two outputs in my view right now.

1) Perform a test on your application, when the field is blank, prompt the user to fill in this field

2) If you still want the field blank, just SET NULL at the time of insertion.

See if this helps you to understand better:

SQL Server inserting Date as 1/1/1900

    
27.04.2016 / 15:06