CmdID

CmdID / PowerShell / Cmdlets / New

New-TimeSpan

Creates a TimeSpan object. PowerShell reference

From the PowerShell reference 6 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Creates a TimeSpan object. 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 DateTime objects. Without parameters, a New-TimeSpan command returns a TimeSpan object that represents a time interval of zero.

New-TimeSpan [[-Start] <DateTime>] [[-End] <DateTime>] [<CommonParameters>]
New-TimeSpan [-Days <Int32>] [-Hours <Int32>] [-Minutes <Int32>] [-Seconds <Int32>] [<CommonParameters>]

Create a TimeSpan object for a specified duration

$TimeSpan = New-TimeSpan -Hours 1 -Minutes 25 $TimeSpanIdentify

Create a TimeSpan object for a time interval

New-TimeSpan -End (Get-Date -Year 2010 -Month 1 -Day 1)Identify

Get the date 90 days from the current date

$90days = New-TimeSpan -Days 90 (Get-Date) + $90daysIdentify

Discover the TimeSpan since a file was updated

Get-ChildItem $PSHOME\en-US\about_remote.help.txt | New-TimeSpanIdentify

Its page in the reference: New-TimeSpan.

Parameters

6 in the PowerShell reference
-DaysSpecifies the days in the time span. The default value is 0.
-EndSpecifies the end of a time span. The default value is the current date and time.
-HoursSpecifies the hours in the time span. The default value is zero.
-MinutesSpecifies the minutes in the time span. The default value is 0.
-SecondsSpecifies the length of the time span in seconds. The default value is 0.
-StartSpecifies the start of a time span. Enter a string that represents the date and time, such as "3/15/09" or a DateTime object, such as one from a Get-Date command. The default value is the current date and time. You can use Start or its alias, LastWriteTime. The LastWriteTime alias lets you pipe objects that have a LastWriteTime property, such as files in the file system ([IO.FileInfo]), to the Start parameter of New-TimeSpan.