This is the built-in help made by Microsoft for the command 'New-TimeSpan', in PowerShell version 2 - as retrieved from
Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Creates a TimeSpan object.
New-TimeSpan [[-Start] <DateTime>] [[-End] <DateTime>] [<CommonParameters>]
New-TimeSpan [-Days <int>] [-Hours <int>] [-Minutes <int>] [-Seconds <int>] [<CommonParameters>]
The New-TimeSpan cmdlet creates a TimeSpan object that represents a time. interval You can use a TimeSpan object to add or subtract time from Dat
eTime objects.
Without parameters, a "New-Timespan" command returns a timespan object that represents a time interval of zero.
<
Online version: http://go.microsoft.com/fwlink/?LinkID=113360
Set-Date
Get-Date
<
-------------------------- EXAMPLE 1 --------------------------
C:\PS>$timespan = new-timespan -hour 1 -minute 25
Description
-----------
This command creates a TimeSpan object with a duration of 1 hour and 25 minutes and stores it in a variable named $timespan. It displays a repres
entation of the TimeSpan object.
-------------------------- EXAMPLE 2 --------------------------
C:\PS>new-timespan -end (get-date -year 2010 -month 1 -day 1)
Description
-----------
This example creates a new TimeSpan object that represents the interval between the time that the command is run and January 1, 2010.
This command does not require the Start parameter, because the default value of the Start parameter is the current date and time.
-------------------------- EXAMPLE 3 --------------------------
C:\PS>$90days = new-timespan -days 90
C:\PS> (get-date) + $90days
Description
-----------
These commands return the date that is 90 days after the current date.