Public/ConvertTo-UnixEpoch.ps1

1
2
3
4
5
6
7
8
9
10
11
function ConvertTo-UnixEpoch {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [datetime]
        $Timestamp
    )

    [int64]($Timestamp - (Get-Date "1/1/1970")).TotalMilliseconds * 1000000
}