Ok. Here is an easy fix for that problem.
You need to first convert the integer or string to date. See the codes below to understand how to do that:
First change this line:
$postdate = date($awyear.'-'.$awmonth.'-'.$awday.' '.$awhour.':'.$awminute.':'.$awsecond);
TO
$postdate = $awyear.'-'.$awmonth.'-'.$awday.' '.$awhour.':'.$awminute.':'.$awsecond;
Now, convert the $postdate
to time string by using strtotime
function.
$cvtpostdate = strtotime($postdate);
$newpostdate = date('Y-m-d H:i:s', $cvtpostdate);
Put this $newpostdate
into the array.
$awpht_the_posts[$i] = array(
'post_title' => $awpharritle[$i],
'post_content' => $awpht_content{$i},
'post_date' => $newpostdate, //<========== Newly generated post date.
'post_status' => 'publish',
'post_author' => 1,
);
There will be no more notice, since you are now using the correct date string.