Question:
I’d like to calculate the time my script runs, but my result from get-date is in totalseconds.
How can I convert this to 31:14:12 behing hours:minutes:seconds?
Answer:
1 2 3 4 |
PS> $ts = New-TimeSpan -Seconds 1234567 PS> '{0:00}:{1:00}:{2:00}' -f $ts.Hours,$ts.Minutes,$ts.Seconds 06:56:07 |
or
1 2 3 |
PS> "$ts" -replace '^\d+?\.' 06:56:07 |