Quantcast
Channel: Working with epoch time in PowerShell using UniversalTime - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Working with epoch time in PowerShell using UniversalTime

$
0
0

This is probably a super simple question, but I'm a bit frustrated now because I can't find exactly what I'm looking for on the internet.

I am trying to convert a PowerShell DateTime to Epoch time using universal time.

I can do either, but can't seem to find a working command to do both.

Here is what I know I can do:

PS C:\WINDOWS\system32> (Get-Date).ToUniversalTime()Wednesday, November 15, 2017 5:07:35 PM

And:

PS C:\WINDOWS\system32> Get-Date -UFormat %s1510747694.20287

But, how do I combine them so that I get seconds since epoch in UTC? Everything I try just gives me errors about unexpected token "UFormat" or String does not have method "ToUniversalTime."

Thanks!


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>