Alan Hart
web design… and other stuff

Alan Hart

Change Juitter Time and Date Format

June 9th, 2010 . by Alan Hart

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







5 Responses to “Change Juitter Time and Date Format”


  1. [...] This post was mentioned on Twitter by Rodrigo Fante and Rodrigo Fante, Alan Hart. Alan Hart said: New Blog Post: Change Juitter Time and Date Format: Here's how you can reformat the default juitter time and date … http://bit.ly/acR5jK [...]

  2. comment number 2 by: Laura London

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

  3. comment number 3 by: Alan Hart

    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.

  4. comment number 4 by: 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?

  5. comment number 5 by: Alan Hart

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

Leave a Reply

Name

Mail (never published)

Website