I have a text box where date is entered in php. Since I want the date to be in particular format I am using.
date("d.m.Y", strtotime())
to conver the date. When no date is give or if I leave the textbox blank it will enter 1970-01-01 to database. How can I solve this?
Here is my code
$d_date= clean($_POST['datum']);
$newdate = date("Y-m-d", strtotime( $d_date));
If $d_date
value is null the it will enter 1970-01-01 to database.
0
as timestamp, it is in fact 1970-01-01 00:00:00strtotime()
is unable to create a time from the given string. What is contained in the$d_date
variable?