New-Timespan - Powershell 1.0 CmdLet
Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.
More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.
Description Create a timespan object Usage Options The timespan can either be a specific number of days/hours/minutes or you can enter a Start/End and powershell will calculate the difference. -startDateTime The start of the timespan. -end DateTime The end of the timespan, may be piped. Default=Now -days int Days in the timespan. -hours int Hours in the timespan. -minutes int Minutes in the timespan. -seconds int Seconds in the timespan. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable. Example(s) Create a TimeSpan object of duration 1 hour plus 90 minutes and store it in a variable named $mytspan: PS C:\>$mytspan = new-timespan -hour 1 -minute 90 Create a new TimeSpan object for Jan 1970 - Jan 1971: PS C:\>$mytspan = new-timespan (get-date -year 1970 -month 01) (get-date -year 1971 -month 01)