Support » Fixing WordPress » Reformat date/time from feed

  • Resolved artfulalibi



    I am using the fetch_rss() native to WP to grab my twitter feed. However, the publish date comes through in a much longer format than I like. Does anyone know if there is a way to manipulate this parsed date using PHP, or is there a file I can alter?

    The date comes in as part of an array $item['pubdate'], and echos out as Tue, 30 Dec 2008 05:47:11 +0000

    I like it to be more like, Dec 30 – 5:47.

    Any help would be great!

    PS. If you are wondering why I don’t use one of the great plugins already developed for twitter ~ I needed a plugin that supports an offset of posts, which none of them do. Fetch_rss() does.

    Thanks everyone.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter artfulalibi



    I found my answer in another forum after more searching.

    For any that are curious:
    $reformdate = date("Y-m-d", strtotime($item['pubdate']));

    The strtotime, converts the string into the a Unix timestamp, from which you can apply it to the standard date function and reformat it however you like.

    Geeking out here!

    Hi artfulalibi,

    So, is there a way to remove the timestamp completely and just have the date i.e. “Y-m-d”?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Reformat date/time from feed’ is closed to new replies.