I'm using this command to check the last modify date on the file.
stat -c '%y' TEST_FILE.tar
result in this date format: 2023-08-21 05:16:10.802947000 +0200
However in may bash script i want to display the date with this format ISO8601 UTC timestamp + ms
date --utc +%FT%T.%3NZ
Expected time in this format: 2023-08-21T03:16:10.854Z
how to get this format?
You can use the formatting capability of
date:The option
-dletsdateformat the given time, notnow. You need the double quotation marks to include the blanks in the argument.