Windows ISO 8601 时间戳

标签 windows powershell timestamp iso8601

我需要将 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/

相关文章:

javascript - 在 TypeScript 和 MongoDB 中仅获取没有时间的日期

windows - 安装Python 2.7.12时出错 "There is a problem with this window installer package"

windows - 安装时如何指定redis的配置文件?

powershell - 类型化属性如何显示在 PowerShell 中的非类型化 DataTable 中?

json - 根据用户输入的Powershell过滤JSON

mysql - 如何获取每月每天的地址数量

c - 将 .Glade(或 xml)文件转换为 C 源代码的工具

Python 多处理 linux windows 区别

PowerShell - 删除所有文本文件行,直到找到某个字符串

mysql 选择 a 和 b 之间的时间戳返回全部或 0 个时间戳