How to manually create pubDate tag in RSS xml using Linux date command ?

We wanted to create an rss xml for our one website, but we had forgotten when was the last time we created this URL,

rss xml has a tag called pubDate which tells the rss feed parsers when the URL was created. And the format of this Tag is as below,

[xml] <pubDate>Wed, 09 Aug 2017 13:25:47 +0530</pubDate> [/xml]

so we created the pubDate xml tag compatible date & time using below script as,

[bash] #format – Wed, 09 Aug 2017 13:25:47 +0530 TZ=`date +"%z"` TIME=`date +"%H:%M:%S"` WEEKDAY=`date +"%a"` DATE=`date +"%d"` MONTH=`date +"%b"` YEAR=`date +"%Y"` FORMATED_DATE_TIME="$WEEKDAY, $DATE $MONTH $YEAR $TIME $TZ" echo "print compatible date format $FORMATED_DATE_TIME" [/bash]

You run the script like below on ubuntu console,

 $ bash 
print compatible date format Sun, 13 Aug 2017 00:51:41 +0530 

Leave a Comment