如何在 powershell 中将本地时间转换为纪元时间戳

sam*_*sam 1 powershell datetime epoch

是否希望找到本地时间到纪元时间戳的转换,但没有运气?有人可以帮我转换这个吗?

Dre*_*rew 5

您所追求的是命令-UFormat的参数Get-Date

Get-Date -UFormat %s
Run Code Online (Sandbox Code Playgroud)

(小写%s)将为您提供自 1970 年 1 月 1 日 00:00:00 以来经过的秒数,如命令的在线部分所述Get-Help。键入get-help get-date -online将带您进入该命令的参数列表Get-Date