Get Paid to Blog About the Things You Love

Dealing with timestamps in WordPress is so fucking fucked.

While modifying a plugin to work correctly in WP 2.5, I came across this code snippet.

I haven’t had to deal with it myself, but maybe someone else will find it useful, or hilarious as I did. Here’s the code to make timestamps WordPress friendly (apprently):

// Dealing with timestamps in WordPress is so fucking fucked.
$offset = (int) get_option('gmt_offset') * 60 * 60;
$this->post['post_date'] = gmdate('Y-m-d H:i:s', $this->published() + $offset);
$this->post['post_modified'] = gmdate('Y-m-d H:i:s', $this->updated() + $offset);
$this->post['post_date_gmt'] = gmdate('Y-m-d H:i:s', $this->published());
$this->post['post_modified_gmt'] = gmdate('Y-m-d H:i:s', $this->updated());
Stumble it!

Post Info

This entry was posted on Sunday, April 27th, 2008 and is filed under development. It has 100 views

Tags:, , ,

Comments Feed. | Leave Comment | Leave Trackback.



Previous Post: Hey, get your HTML5 off my canvas »
Next Post: Put Ads on Top of Your Ads - Adbrite Ad Network »
Most viewed posts


Leave a Reply

Note: Any comments are permitted only because the site owner is letting you post, and any comments will be removed for any reason at the absolute discretion of the site owner.