加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Windows ISO8601时间戳

发布时间:2020-12-13 22:28:10 所属栏目:Windows 来源:网络整理
导读:我需要将 windows powershell中的日期转换为ISO8601格式. 在 linux / unix中没问题 TZ=0 date -d "random-format" +%Y-%m-%dT%H:%M:%S.000Z 现在我需要在windows powershell中做同样的事情. Windows上的输出格式是 2017年7月19日星期三01:06:13 有什么提示吗
我需要将 windows powershell中的日期转换为ISO8601格式.
在 linux / unix中没问题

TZ=0 date -d "<random-format>" +%Y-%m-%dT%H:%M:%S.000Z

现在我需要在windows powershell中做同样的事情. Windows上的输出格式是

2017年7月19日星期三01:06:13

有什么提示吗?

解决方法

Powershell的Get-Date支持标准的.Net时间格式. o round-trip格式符合ISO 8601.喜欢这样,

Get-Date -Format "o"
2017-08-15T12:10:34.4443084+03:00

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读