how to convert from one date format to another format in linux ?

 how to convert from one date format to another format in linux ?

echo 04-11-2021 | { IFS=- read d m y && echo “$y$m$d”; }

20211104


echo 04-11-2021 | { IFS=- read d m y && echo “$y/$m/$d”; }

2021/11/04


 echo 04-11-2021 | { IFS=- read d m y && echo “$d$m$y”; }

04112021


 echo 04-11-2021 | awk -F- ‘{print $3$2$1}’

20211104


echo 04-11-2021 |gawk -F, ‘{split($1, a, “-“); print a[3] a[2] a[1]}’ 

20211104

echo 04/11/2021 | { IFS=/ read d m y && echo “$y$m$d”; }

20211104


date -d “20211104” “+%Y-%m-%d”

2021-11-04

date -d 04/11/2021 +%F

2021-04-11

 %F   full date; same as %Y-%m-%d

***: Reklamu lze objednat tady | Více ke čtení zde : https://www.linuxforfreshers.com/2020/12/how-to-convert-from-one-date-format-to.html
Sponzorováno:
Obchodujte Kryptoměny