如何在Linux/Centos/Rhel中使用Shell脚本转换Milliseonds中的任何日期格式

发布于 2025-02-10 02:32:37 字数 154 浏览 1 评论 0原文

如何在Linux/Centos/Rhel中使用shell脚本

日期格式中的Milliseonds中的任何日期格式转换。 THU,2022年6月23日08:27:26 +0000, thu Jun 23 11:11:43 UTC 2022, 2022-06-23T08:28:23Z

How to convert any date format in milliseonds in linux/centos/rhel with shell script

Date formats like:
Thu, 23 Jun 2022 08:27:26 +0000,
Thu Jun 23 11:11:43 UTC 2022,
2022-06-23T08:28:23Z

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不奢求什么 2025-02-17 02:32:37

这可以用命令以毫秒为单位进行转换:

date -d "2022-06-23T08:28:23Z" +"%s%N"

任何其他日期格式也可以通过上述命令转换为:

date -d "Thu, 23 Jun 2022 08:27:26 +0000" +"%s%N"
date -d "Thu Jun 23 11:11:43 UTC 2022" +"%s%N"

This can be converted in milliseconds with command:

date -d "2022-06-23T08:28:23Z" +"%s%N"

Any other format of date can also be converted with above command like:

date -d "Thu, 23 Jun 2022 08:27:26 +0000" +"%s%N"
date -d "Thu Jun 23 11:11:43 UTC 2022" +"%s%N"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文