Any way to create scheduled post programatically?

I found my answer while searching over other stackoverflow answers below is the code what I’ve added.

$postdate = date('Y-m-d H:i:s',strtotime('+20 minutes'));
$postdate_gmt = gmdate('Y-m-d H:i:s',strtotime($postdate));

$post = array(
    'post_date_gmt'  => $postdate_gmt,
    'post_date'  => $postdate,
    'edit_date' => 'true'
);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)