简体   繁体   English

如何在Powershell中将Localtime转换为纪元时间戳

[英]How do I convert Localtime to epoch timestamp in powershell

Did look to find conversion of localtime to epoch timestamp but no luck? 是否希望找到本地时间到纪元时间戳的转换但没有运气? can someone help me out converting this. 有人可以帮我转换一下吗。

What you are after is the -UFormat parameter for the Get-Date command. 您需要的是Get-Date命令的-UFormat参数。

Get-Date -UFormat %s

The %s (lowercase) will give you seconds elapsed since January 1, 1970 00:00:00 as outlined in the online section of the Get-Help command. Get-Help命令的联机部分所述, %s (小写字母)将为您提供自1970年1月1日00:00:00起经过的秒数。 Typing get-help get-date -online will take you to the list of parameters for the Get-Date command. 键入get-help get-date -online将带您进入Get-Date命令的参数列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM