Skip to content

Instantly share code, notes, and snippets.

@h3nryza
Created July 17, 2018 17:31
Show Gist options
  • Select an option

  • Save h3nryza/f35aec80f825854cc22d1484a262dc84 to your computer and use it in GitHub Desktop.

Select an option

Save h3nryza/f35aec80f825854cc22d1484a262dc84 to your computer and use it in GitHub Desktop.
Powershell Epoch to human time
#Get EPOCH time ( Unix Time)
#The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).
[int][double]::Parse((Get-Date (get-date).touniversaltime() -UFormat %s))
#Convert from Epoch to human time
$origin = New-Object -Type DateTime -ArgumentList 1970, 1, 1, 0, 0, 0, 0
$whatIWant = $origin.AddSeconds($unixTime)
left(10)
$e = $e.Substring(0,10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment