March 15th, 2013

PowerTip: Use PowerShell to Find the Number of Seconds in Three Days

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to easily find the number of seconds in three days.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find how many seconds are in three days without diving into a bunch of multiplication or division?

Hey, Scripting Guy! Answer Use the New-TimeSpan cmdlet to create a time span of three days, and select the TotalSeconds property:

PS C:\> (New-TimeSpan -Days 3).totalseconds

259200 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback