获取bash日期2023-04-03T23:59:59.000Z格式



如何获取以下格式的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.

相关内容

  • 没有找到相关文章

最新更新