Tag Archive: reformat date and time

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