[wp-hackers] error in using wp_insert_comment. date puzzle.
John Blackbourn
johnbillion+wp at gmail.com
Fri Aug 3 02:12:47 UTC 2012
On 3 August 2012 02:23, Haluk Karamete <halukkaramete at gmail.com> wrote:
> var_dump view of the $the_date is as follows;
>
> object(DateTime)#97 (3) {
> ["date"]=>
> string(19) "2012-07-30 00:00:00"
> ["timezone_type"]=>
> int(3)
> ["timezone"]=>
> string(3) "UTC"
> }
>
> How can I go around this problem and store the date properly? 2012-07-30
> 00:00:00
You need to get a date string from your DateTime object and pass that
into the comment_date parameter instead.
$comment_date = $the_date->format('Y-m-d H:i:s');
John
More information about the wp-hackers
mailing list