1

I'm trying to convert Epoch/UNIX time to a readable date. See the code below:

Get-Date 1472563804 -UFormat "%D %R"

PowerShell is throwing the following output:

01/01/01 00:02

http://www.epochconverter.com/ is showing the date as Tue, 30 Aug 2016 13:30:04 GMT so it seems to be an issue specific to PowerShell. I've also tested other Epoch/UNIX times and PowerShell continues to throw the same date/time as above.

Keefer
  • 59
  • 1
  • 3
  • 8
  • 1
    This type of question was asked earlier: http://stackoverflow.com/questions/10781697/convert-unix-time-with-powershell/21234844#21234844 – paul543 Aug 31 '16 at 14:52

1 Answers1

3
$epoch = Get-Date -Date "1970-01-01 00:00:00Z"
$epoch = $epoch.ToUniversalTime()
$epoch = $epoch.AddSeconds(1472563804)

$epoch
David Brabant
  • 41,623
  • 16
  • 83
  • 111