[wp-hackers] Date not converting/saving in post meta correctly

Andrew Nacin wp at andrewnacin.com
Thu Jun 23 05:01:00 UTC 2011


On Tue, Jun 21, 2011 at 11:17 AM, Mitch Canter <mitch at mitchcanter.com>wrote:

> http://pastebin.com/2WZyG940
>
> I’ve pasted the code above because for some reason when I update the post,
> the “start date” doesn’t save into the meta as unixtime as it should – it
> only saves as a string, and I end up getting errors.  The “end date” does,
>  and that’s what’s confusing the heck out of me.
>
> Server is running php5 and apache on a bluehost shared install, if that
> helps.
>
> Warning: date() expects parameter 2 to be long, string given in
> /home5/ccfedmon/public_html/wp-content/themes/ccfchurch/functions.php on
> line 468
>
> Warning: date() expects parameter 2 to be long, string given in
> /home5/ccfedmon/public_html/wp-content/themes/ccfchurch/functions.php on
> line 470
>
> That’s what pops up in the editor (those numbers won’t match up to the
> functions.php because I’ve only brought in the code that deals with that
> specific area... but here’s the lines in question):
>
> 468 - $clean_sd = date("D, M d, Y", $meta_sd);
> 469 - $clean_ed = date("D, M d, Y", $meta_ed);
> 470 - $clean_st = date($time_format, $meta_st);
> 471 - $clean_et = date($time_format, $meta_et);
>

Have you actually var_dump()'d the four variables? Clearly two of them
(likely one of them, as then another is a copy) is a string. :-)

Nacin


More information about the wp-hackers mailing list