0

Am trying to insert date to a MYSQL column with datatype DATE . the following code is used.

$expiry = date("Y-m-d H:i:s", $_POST['expiry']);

but the mysql column shows 01-Jan-70 12:00:00 AM . have also used strtotime() but it seems to insert NULL.

The html input takes YYYY-MM-DD as date format input

any help appreciated.

display-name-is-missing
  • 4,424
  • 5
  • 28
  • 41
Abdul Ali
  • 1,905
  • 8
  • 28
  • 50

1 Answers1

0

thank you for the comments. although all comments may likely be helpful but Wasim's link seemed to provide the solution:

have simply saved the date in a variable without any transformations as follows:

$expiry = $_POST['expiry']; // $_POST['expiry'] = YYYY-MM-DD

thank you for all the help though..

Abdul Ali
  • 1,905
  • 8
  • 28
  • 50