Powershell: Convert UNIX Timestamp to DateTime

Hi,

simple one liner to convert an UNIX Timnestap to DataTime object.

PS D:\> $oUNIXDate=(Get-Date 01.01.1970)+([System.TimeSpan]::fromseconds(1537615930))
PS D:\> $oUNIXDate
Samstag, 22. September 2018 11:32:10

Michael

Advertisment to support michlstechblog.info

Add a comment »One comment to this article

  1. Hi! Another way:
    $Date = (Get-Date 01.01.1970).AddSeconds(1537615930)

    Reply

Time limit is exhausted. Please reload CAPTCHA.

Original Theme by Schiy · Powered by WordPress