View Full Version : gAjax RSS Pausing Scroller
ja5on
08-27-2009, 11:20 PM
1) Script Title:gAjax RSS Pausing Scroller : Changing the Date Format
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxpausescroller.htm
3) Describe problem: HI there, basically got this script working fine, just want to change the date format, it currently shows the date in this format "27 August 2009" I would like to display the date as "27/08/09 (dd/mm/yy)" - sure this is pretty simple to do but cant get my head around this and its driving me crazy :confused:
Hope someone can help as this code is awesome and this is the only thing that I cant seem to customise, incidentally it displays in Opera in the dd/mm/yy date format. Thanks
ddadmin
08-30-2009, 06:27 PM
Inside gfeedfetcher.js, try finding the following function:
gfeedfetcher._formatdate=function(datestr, showoptions){
var formatfield=function(f){
return (f<10)? '0'+f : f
}
var itemdate=new Date(datestr)
var parseddate=(showoptions.indexOf("datetime")!=-1)? itemdate.toLocaleString() : (showoptions.indexOf("date")!=-1)? itemdate.toLocaleDateString() : (showoptions.indexOf("time")!=-1)? itemdate.toLocaleTimeString() : ""
return "<span class='datefield'>"+parseddate+"</span>"
}
and replace that with:
gfeedfetcher._formatdate=function(datestr, showoptions){
var formatfield=function(f){
return (f<10)? '0'+f : f
}
var itemdate=new Date(datestr)
var parseddate=(showoptions.indexOf("datetime")!=-1)? itemdate.toLocaleString() : (showoptions.indexOf("date")!=-1)? itemdate.toLocaleDateString() : (showoptions.indexOf("time")!=-1)? itemdate.toLocaleTimeString() : ""
return formatfield(itemdate.getDate())+"/" + formatfield(itemdate.getMonth()+1) + "/" + formatfield(itemdate.getFullYear())
}
ja5on
08-31-2009, 09:53 AM
That works great but how do I add the time to the end of the date string so eg 31/09/2009 - 13:23:12
Thanks for your time :)
ja5on
ddadmin
09-01-2009, 02:38 AM
Sure, try the code:
gfeedfetcher._formatdate=function(datestr, showoptions){
var formatfield=function(f){
return (f<10)? '0'+f : f
}
var itemdate=new Date(datestr)
var parseddate=(showoptions.indexOf("datetime")!=-1)? itemdate.toLocaleString() : (showoptions.indexOf("date")!=-1)? itemdate.toLocaleDateString() : (showoptions.indexOf("time")!=-1)? itemdate.toLocaleTimeString() : ""
return formatfield(itemdate.getDate())+"/" + formatfield(itemdate.getMonth()+1) + "/" + formatfield(itemdate.getFullYear()) + " - " + formatfield(itemdate.getHours())+":" + formatfield(itemdate.getMinutes()+1) + ":" + formatfield(itemdate.getSeconds())
}
ja5on
09-05-2009, 08:26 AM
This code works like a dream many thanks for all your help
Awesome :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.