powershell - Use UFormat to get unix time -


I can use the following to add a date to a text:

  "Foo {0: g} Foo" -f (date) # layers "Foo 2009-12-07 15:34:16 Foo"  

But I want time in UNIX format I can get it from the date -UFormat% s , but can I use the same syntax?

When I use -UFormat% s 1260199855,65625 , how do I remove the decimal?

Just insert the results for doing so:

  PS & Gt; [Int] [double]: parse ((get-date-usform% s)) 1260172909 Ps & gt; "FU {0: g} fu" -f [int] [double] :: parse (gate-date-usformat% s)) Fu 1260172997 FU  

Using parse method string Is called "culture conscious", so that appropriate decimal separator character is recognized for the present culture. If you straighten straight up, PowerShell uses the immutable culture which causes problems for any culture, where there is no four term for decimal asp.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -