Change date type in pubdate
Hello, I'm developing an RSS service, and in want modify the pubDate. Now I have this date format: "Sat, 24 May 2014 16:08:43 +0000". And I want this format: "24-5-14".
Thanks.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hello, I'm developing an RSS service, and in want modify the pubDate. Now I have this date format: "Sat, 24 May 2014 16:08:43 +0000". And I want this format: "24-5-14".
Thanks.
Hello.
Please use following code:
pre
//This is your format date string variable. Please replace it with value you need. Or assign to other variable.
var yourFormatDate = "Sat, 24 May 2014 16:08:43 +0000";
var yourDate = new Date(yourFormatDate);
var newDateFormat = yourDate.getDate() + "-" + (yourDate.getMonth() + 1) + "-" + yourDate.getFullYear().toString().match(/\d\d$/gi)
/pre
Regards.