简体   繁体   中英

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 %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. Typing get-help get-date -online will take you to the list of parameters for the Get-Date command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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