Date always 01-01-1970
Hi, this is most probably not an issue with with DA but has anyone come across this before, I usually work with SQL & asp so not sure?
I have fields which users can use a datepicker to enter a date. At top of each php page I have the following to allow uk format input but insert to db in its recognised values:
<?php
if(isset($_POST['ContactDOB']) && $_POST['ContactDOB'] != "") {
$_POST['ContactDOB'] = date("Y-m-d", strtotime($_POST['ContactDOB']));
}
?>
<?php
if(isset($_POST['StatusAppDate']) && $_POST['StatusAppDate'] != "") {
$_POST['StatusAppDate'] = date("Y-m-d", strtotime($_POST['StatusAppDate']));
}
?>
<?php
if(isset($_POST['StatusActiveDate']) && $_POST['StatusActiveDate'] != "") {
$_POST['StatusActiveDate'] = date("Y-m-d", strtotime($_POST['StatusActiveDate']));
}
?>
<?php
if(isset($_POST['ContactCompDate']) && $_POST['ContactCompDate'] != "") {
$_POST['ContactCompDate'] = date("Y-m-d", strtotime($_POST['ContactCompDate']));
}
?>
<?php
if(isset($_POST['StatusNPWDate']) && $_POST['StatusNPWDate'] != "") {
$_POST['StatusNPWDate'] = date("Y-m-d", strtotime($_POST['StatusNPWDate']));
}
?>
However all fields dont have date selected write 01-01-1970 into table, is this normal? I have checked table and its set as 'Date', 'NULL' & allow NULL is checked.
Thanks