$NOW = new DateTime();
$date = $NOW->format('Y-m-d'); // return 2018-05-17
I want to update date in database to now date.
Query:
$sql = "UPDATE table SET date = $date WHERE id = $id";
But it update time like this => 0000-00-00
The type of this column is DATE
Why? what I have done wrong?