If you look at Get-Help Get-Date
the first parameter is a -Date
option. We can use that to our advantage by wrapping our Get-Date
in another Get-Date
like so:
$epochseconds = Get-Date (Get-Date).ToUniversalTime() -UFormat %sreturn $epochseconds