我需要将 Windows PowerShell 中的日期转换为 ISO 8601 格式。
在 Linux/Unix 下没问题
TZ=0 date -d "<random-format>" +%Y-%m-%dT%H:%M:%S.000Z
现在我需要在 Windows PowerShell 中执行相同的操作。 Windows 上的输出格式为
Wednesday, 19. July 2017 01:06:13
我该怎么做?
最佳答案
PowerShell 的 Get-Date
支持标准的.NET 时间格式。 o
round-trip格式符合 ISO 8601。像这样,
Get-Date -Format "o"
2017-08-15T12:10:34.4443084+03:00
关于Windows ISO 8601 时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45689471/