Change Juitter Time and Date Format

As you can see in the sidebar on the left i am using Juitter to retrieve my twitter feed, I didn’t like the default juitter date format because it’s rather long (“ddd,dd mm yyyy hh:mm:ss +0000”)

Here’s how you can reformat the default juitter time and date format…

Just insert the code below into the “jquery.juitter.js” file, underneath the line “var tweet = $.Juitter.filter(item.text);”

// Re-format Date/Time
//get Tweet date
var d=new Date(item.created_at); //Default date/time is when the tweet was published
var tweetdate=d.toLocaleDateString(); //rewrite date in a nicer way
//get Tweet time
var t=new Date(item.created_at);
var tweettime=t.toLocaleTimeString().substr(0,5); //rewrite and remove seconds
//pull it together
var timestamp=""+tweetdate+" at "+tweettime+"";
// Reformat Date/Time

Then in the few lines below this newly inserted code (the code that generates the HTML) replace “item.created_at” with “timestamp”

Simple!

main date conversion taken from: http://www.ibrii.com/n/f317z

10 Comments

  1. Jordan Judson

    Exactly what I was looking for. I couldn’t stand that format for the dates. Thanks a bunch.

  2. Emilio

    I was getting frustrated. Time to learn some php myself, but for the moment, you saved my life. Thank you very much!

  3. paul

    Thanks for putting this out there, exactly what I was looking for!

  4. Bryan

    I’d like to remove the day name (Wednesday, etc) from this. Possible?

  5. Azhar

    Hi, is there a way to change it to 5 hours ago or 2 days ago kinda format?

  6. Alan Hart (Post author)

    email me your code for this and i’ll have a look… My email: alan (at) alanhart (dot) co (dot) uk

  7. xiabolai

    hi, thanks for this code. i wanted to do the very same thing. i inserted your code exactly as described and replaced the two instances of “timestamp” but it broke the juitter output. any ideas?

  8. Alan Hart (Post author)

    To remove the time & date completely…
    underneath the line :
    var tweet = $.Juitter.filter(item.text);
    in the”jquery.juitter.js” file.
    Remove “item.created_at”. It appears twice so make sure you remove both occurances.

  9. Laura London

    Is there a way to remove the time & date entirely?

  10. Pingback: Tweets that mention Change Juitter Time and Date Format - Alan Hart - web design… and other stuff - Blog Archive -- Topsy.com

Comments are closed.