Marine1969
IS-IT--Management
I have been all over the internet and tried numerous options to get a date to save. I have 2 date and 1 time field I am trying to change in a mysql table. My data I change to 11/17/2017 but the code changes it to 12/31/1969. Everything I found on on the internet was for using the current system date but I am passing a field to record maintenance page and have changed all 3 fields in the db to be datetime.
edate = 11/05/2017
sdate = 11/17/2017
myid = 1
I have tried date ("Y-m-d", $edate) and many other variations. I also had the fields originally set to Date and Time but have not done much with the Time field, figured I would concentrate on the Date fields first. Does anyone have any ideas?
edate = 11/05/2017
sdate = 11/17/2017
myid = 1
PHP:
$str = "Update mytable Set edate = :edate, sdate = :sdate, stime = :stime Where id = :myid";
$stmt = $conn->prepare($str);
$stmt->bindParam(':edate', $_POST['edate'], PDO::PARAM_STR);
$stmt->bindParam(':sdate', $_POST['sdate'], PDO::PARAM_STR);
$stmt->bindParam(':myid', $_POST['myid'], PDO::PARAM_STR);
I have tried date ("Y-m-d", $edate) and many other variations. I also had the fields originally set to Date and Time but have not done much with the Time field, figured I would concentrate on the Date fields first. Does anyone have any ideas?