strtotime return wrong value upon blank field – form submission
Date selection is working fine but empty field giving 01-01-1970
<form method="post">
<input type="date" name="DOB"/>
<input type="submit" value="Submit" name="BtnSubmit"/>
</form>
<?php
if(isset($_POST["BtnSubmit"]))
{$F_DOB = $_POST["DOB"];
$F_DOBNew = date("d-m-Y", strtotime($F_DOB));
echo $F_DOBNew;}
?>
Above is the code what I am doing and working fine upon clicking the button. Few date fields are not required so when a user click on the button and left the date fields empty, the empty date fields shows 01-01-1970 upon submission.