如何获取以下格式的bash日期
2023-04-03T23:59:59.000Z
我尝试连接字符串,但它看起来不干净
您可以使用以下date
命令:
date -u +"%FT%T.%3NZ"
:
-u flag tells date to use the UTC timezone
%F specifier is a shorthand for %Y-%m-%d
%T specifier is a shorthand for %H:%M:%S
%3N specifier represents the milliseconds in the current time
Z at the end indicates that the time is in UTC.