Im trying to insert date into a wpdb, it fetches name and comment from a form but I cant get todays date to work, it all works if I exclude the date, what am I doing wrong?
global $wpdb;
$name = "";
$comment = "";
$current_date = date("YY-mm-dd");
$wpdb->insert ( $table_name, array( "name" => $_POST["name"], "comment" => $_POST["comment"], "date" => $_POST["$current_date"]));
You didn’t explain your date format but I think this work for you
it will give you today date like “2016-05-20” or if you want you can add hour to format like “2016-05-20 23:33:52”
and please change this
only today date
with time