Hi,

Firstly awesome module, loving it. Thank you.

How would I change the date formatting in what juitter displays?

I am getting this
Fri, 12 Feb 2010 10:52:46 +0000

I want this
Fri, 12 Feb 2010 10:52

Thanks
Gregg

Comments

iaminawe’s picture

found this link but his question is unanswered. maybe its a starting point though

http://www.sitepoint.com/forums/showthread.php?s=e5eb813d025f9a15c6f81e5...

He says he is trying to do it like this. I would be happy with this time ago format as well for my purposes.

function relative_time(time_value) {
var values = time_value.split(" ");
time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
var parsed_date = Date.parse(time_value);
var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
delta = delta + (relative_to.getTimezoneOffset() * 60);

var r = '';
if (delta < 60) {
r = 'a minute ago';
} else if(delta < 120) {
r = 'couple of minutes ago';
} else if(delta < (45*60)) {
r = (parseInt(delta / 60)).toString() + ' minutes ago';
} else if(delta < (90*60)) {
r = 'an hour ago';
} else if(delta < (24*60*60)) {
r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';
} else if(delta < (48*60*60)) {
r = '1 day ago';
} else {
r = (parseInt(delta / 86400)).toString() + ' days ago';
}

AlanHart’s picture

I have just done exactly this, in a slightly different format but much shorter than the default.
See the code on my blog... http://www.alanhart.co.uk/archives/2010/06/09/change-juitter-time-and-da...