Changing The Timestamp Format To "Month Day, Year" from yyyy/mm/dd


Hello All. I am using AJAX to pull JSON elements from blogger blog. Everything is working fine but i got stucked here. I want to chenge date from 2015-03-23 to Mar 23, 2015. I have used jQuery find and replace method but failed. I also looked stackoverflow but not satisfied with all them. Is there any way.


What you want is a calendar Date Format to display post dates. I have seen many magazine Blogger templates which are using this format using the function below

// Calendar Date Format 
function datenya(a){a(".datex .time").each(function(){var d=a(this).attr("title");var b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(d!=""){var g=d.substring(0,10),h=g.substring(0,4),f=g.substring(5,7),e=g.substring(8,10),c=b[parseInt(f,10)-1]}a(this).html(c+" "+e+", "+h)})};

They are then calling the date from blogger Feeds and replacing the date data with their custom format. I hope the function above gives you some idea and you need to have good knowledge of javascript in order to call the function above inside your script


Above code is working fine. But what to do if i want to show “About an hour ago” in place of timestamp. I mean to say that the difference between Post Published Date and Current Date. And one more question. Can we get the number of comments with the help of JSON in blogger?


Great that it worked for you! :smile:

You can at present display the timestamp function in the above few formats only because Blogger JSON API does not currently give duration in seconds or minutes. Further creating a custom script will slow down your page.

You can get full knowledge about this script by going through the JSON API for featured posts created by my friend Aneesh Joseph.

  • [Show Featured posts by labels][1]

He is the original developer of this logic, rest everyone who is sharing the script without giving due credits to aneesh is a violator. [1]: