Results 1 to 5 of 5

Thread: gAjax RSS Pausing Scroller

  1. #1
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default gAjax RSS Pausing Scroller

    1) Script Title:gAjax RSS Pausing Scroller : Changing the Date Format

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...sescroller.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

    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
    Last edited by ja5on; 08-28-2009 at 07:27 AM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Inside gfeedfetcher.js, try finding the following function:

    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 "<span class='datefield'>"+parseddate+"</span>"
    }
    and replace that with:

    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())
    }
    DD Admin

  3. #3
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile gAjax RSS Pausing Scroller

    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

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure, try the code:

    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())
    }
    DD Admin

  5. #5
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    This code works like a dream many thanks for all your help

    Awesome

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •