Insert date into wpdb

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"]));

Related posts

Leave a Reply

1 comment

  1. 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

    "date" => $_POST["$current_date"]
    to
    "date" => $current_date 
    

    only today date

    $current_date = date("Y-m-d");
    

    with time

    $current_date = date("Y-m-d H:i:s");