Creating a DateTime object with a specific UTC DateTime in PowerShell

前端 未结 6 1160
野趣味
野趣味 2021-02-02 07:23

I\'m trying to create a DateTime object with a specific UTC timestamp in PowerShell. What\'s the simplest way to do this?

I tried:

Get-Date
         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 07:57

    $time = [DateTime]::UtcNow | get-date -Format "yyyy-MM-ddTHH:mm:ssZ"
    

    This appears to also work

提交回复
热议问题