Zazar Homepage
Forum Home Forum Home > Zazar > Help & Discussion
  New Posts New Posts RSS Feed - display month names instead of integers
  FAQ FAQ  Forum Search   Register Register  Login Login

display month names instead of integers

 Post Reply Post Reply
Author
Message
ehobart View Drop Down
Newbie
Newbie


Joined: 23 Oct 2011
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote ehobart Quote  Post ReplyReply Direct Link To This Post Topic: display month names instead of integers
    Posted: 23 Oct 2011 at 16:46
Hello,

Has anyone created code that will convert month integers into days?

I've changed the pubDate code to display only month and date:

var pubDate;
if (entry.publishedDate) {
var entryDate = new Date(entry.publishedDate);
var pubDate = entryDate.getMonth() + ' ' + entryDate.getDate();
}

but I am not sure what the best method is for converting the month integers into names. I think maybe an array, but I'm not sure where to introduce it in the code or how ot modify the final var pubDate line to perform the conversion.

Any help will be greatly appreciated.

Thanks
Back to Top
David View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 Oct 2009
Points: 224
Post Options Post Options   Thanks (0) Thanks(0)   Quote David Quote  Post ReplyReply Direct Link To This Post Posted: 26 Oct 2011 at 07:05
Hi

Change the pubDate variable to:

var pubDate = getMonthName(entryDate.getMonth())+ ' '+ entryDate.getDate();

and then add the following function (after the getXMLDocument function):

function getMonthName(month) {
var name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
return name[month];
}

That should produce Jul 4, Oct 25, Nov 1 etc.
David Woolston
Zazar Support
Back to Top
creativethien View Drop Down
Newbie
Newbie


Joined: 24 Jan 2013
Location: Orlando
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote creativethien Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jan 2013 at 15:18
I tried this code for the current release, Version: 1.1.9

I still get the results displaying as "23/01" instead of the month name. Where exactly should I place the code below?


function getMonthName(month) {
var name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
return name[month];
}




What I did was placed it after this code.

var _getXMLDocument = function(string) {
          var browser = navigator.appName;
          var xml;
          if (browser == 'Microsoft Internet Explorer') {
               xml = new ActiveXObject('Microsoft.XMLDOM');
               xml.async = 'false';
               xml.loadXML(string);
          } else {
               xml = (new DOMParser()).parseFromString(string, 'text/xml');
          }
          return xml;
     }
Back to Top
David View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 Oct 2009
Points: 224
Post Options Post Options   Thanks (0) Thanks(0)   Quote David Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jan 2013 at 17:25
Hi

We have added the additional month name format and released a new version (1.2.0). If you use the new tag 'MMMM' it will return the month name.

See our example at http://www.zazar.net/developers/jquery/zrssfeed/example_dateformats.html

Download the new version at http://www.zazar.net/developers/jquery/zrssfeed/
David Woolston
Zazar Support
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 10.15
Copyright ©2001-2013 Web Wiz Ltd.