Windows ISO 8601 时间戳 [英] Windows ISO 8601 timestamp

查看:64
本文介绍了Windows ISO 8601 时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将 Windows PowerShell 中的日期转换为 ISO 8601 格式.

I need to convert a date in Windows PowerShell to the ISO 8601 format.

在 Linux/Unix 中没有问题

In Linux/Unix it was no problem with

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

现在我需要在 Windows PowerShell 中执行相同的操作.Windows 上的输出格式为

Now I need to do the same in Windows PowerShell. The output format on Windows is

Wednesday, 19. July 2017 01:06:13

我该怎么做?

推荐答案

PowerShell 的 Get-Date 支持标准的 .NET 时间格式.o 往返 格式符合 ISO 8601.像这样,

PowerShell's Get-Date supports standard .NET time formats. The o round-trip format complies with ISO 8601. Like so,

Get-Date -Format "o"

2017-08-15T12:10:34.4443084+03:00

这篇关于Windows ISO 8601 时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆