Created
July 17, 2018 17:31
-
-
Save h3nryza/f35aec80f825854cc22d1484a262dc84 to your computer and use it in GitHub Desktop.
Powershell Epoch to human time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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