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

Post Free Ads for Agri, Solar, Eco products

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,

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

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

#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"

You run the script like below on ubuntu console,

 $ bash format-date.sh 
print compatible date format Sun, 13 Aug 2017 00:51:41 +0530 
Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded
Tags:

Leave a Reply