Entware Need help converting dates in shell script


Senior Member
I need some advice from coders here that have been using this version of Linux. I appreciate your help in advance.
Here is this example:

Run command "curl -s -I http://sbc.io/hosts/hosts | grep "[Ll]ast-[Mm]odified" | cut -c16-"
This retrieves Last-Modified time for a specific file. In this case it is a string Tue, 13 Apr 2021 14:04:19 GMT
I would like to convert this string to a format +%Y%m%d%H%M .

It is very easy on macOS/BSD since it does support date converting "from" to "new" format as in
date -jf '%A, %d %B %Y %H:%M:%S %Z' "${mydate}" '+%Y%m%d%H%M'

However on Asus Linux version I am not familiar how this can be converted. Any ideas or suggestions, I would appreciate it. Maybe someone already had solved it or do I need to include some entware lib to help with this work.


Part of the Furniture
If you have Entware you can install coreutils-date which contains a more versatile version of date.

# /opt/bin/date -d 'Tue, 13 Apr 2021 14:04:19 GMT' +%Y%m%d%H%M

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!