New-TimeSpan - PowerShell


 

Creates a TimeSpan object. (New-TimeSpan)

   

# NAME
New-TimeSpan

# SYNOPSIS
Creates a TimeSpan object.

# SYNTAX
New-TimeSpan [[-Start] <DateTime>] [[-End] <DateTime>] [<CommonParameters>]

New-TimeSpan [-Days <int>] [-Hours <int>] [-Minutes <int>] [-Seconds <int>] [<CommonParameters>]

# DESCRIPTION
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.

# PARAMETERS
-Days <int>
Indicates the days in the time span. The default is 0.

Required? false
Position? named
Default value 0
Accept pipeline input? false
Accept wildcard characters? false

-End <DateTime>
Indicates the end of a time span. The default is the current date and time.

Required? false
Position? 2
Default value Current date and time
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

-Hours <int>
Indicates the hours in the time span. The default is zero.

Required? false
Position? named
Default value 0
Accept pipeline input? false
Accept wildcard characters? false

-Minutes <int>
Indicates the minutes in the time span. The default is 0.

Required? false
Position? named
Default value 0
Accept pipeline input? false
Accept wildcard characters? false

-Seconds <int>
Indicates the length of the time span in seconds. The default is 0.

Required? false
Position? named
Default value 0
Accept pipeline input? false
Accept wildcard characters? false

-Start <DateTime>
Indicates 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 is the current date and time.

Required? false
Position? 1
Default value Current date and time
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.DateTime
You can pipe a DateTime object that represents that start time to New-TimeSpan.

# OUTPUTS
System.Timespan
New-TimeSpan returns an object that represents the time span.

# NOTES

# 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 representation 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.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113360
Set-Date
Get-Date

C:\Windows>powershell get-help Read-Host -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole








Windows-10





Windows-10

... facebook.de
... Windows-10 FAQ
... Windows-10 Info


Become a Sponsor
... Your button here?





PowerShell: Creates a TimeSpan object.

HTTP: ... PS_Windows/en/New-TimeSpan.htm
0.187
9216

How can I save my own signature as an image file?

 /

WhatsApp lässt sich nicht aktualisieren, zu wenig Speicher!

 /

Wie kann man das WLAN / WIFI deaktivieren bei Windows-7 (8.1, 10)?

 /

Are the full versions of Software freeware on SoftwareOK?

 /

Bildschirmlupe oder Bildschirmtastatur unter Windows XP schnell aufrufen!

 /

Program with which you can transform JPG into PDF!

 /

Where is the Send To folder in windows 10, how to open?

 /

Lösung um lange Dateipfade in der CMD-Eingabeaufforderung einzufügen!

 /

Start an incognito, anonymous or private browsing via Chrome on Windows!

 /

Beenden der Prozesse und Programme erzwingen?

 /

Can I Switch users in windows 7 excluding logging off ?

 /

How can I backup the individual entries or export from Quick-Text-Paste?

 /