Want to change the post date and time with function in WordPress? You can do this by calling wp_update_post() function with a special value for
$time = current_time('mysql');
'ID' => 123, // ID of the post to update
'post_date' => $time,
'post_date_gmt' => get_gmt_from_date( $time )
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.