【发布时间】:2016-02-12 16:52:58
【问题描述】:
我需要识别这个包含日期的字符串
20151110171937.050162+060
它是对象Get-WmiObject -Class win32_process 的CreationDate 属性。我需要将它用作New-TimeSpan cmdlet 的输入。因此,它应该是有效的[DateTime] 对象,但我不知道如何转换它。
【问题讨论】:
-
尝试投射 [System.DateTime]
-
Get-WmiObject -Class win32_process|ForEach-Object {$_.ConvertToDateTime($_.CreationDate)}
标签: string powershell datetime