[Snippet] Formatting the date in twitter XML feed

The date in the Twitter XML feed is daft and ugly! It reads [created_at] => Wed Aug 03 23:34:35 +0000 2011

We can easily format this with PHP using date() and strtotime()

$latest_tweet_date = date("l M j \- g:ia",strtotime($tweet->status[0]->created_at));

 

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *