Skip to content

Add TimeSpan

github-actions edited this page May 1, 2026 · 1 revision

external help file: ModernConveniences-help.xml Module Name: ModernConveniences online version: schema: 2.0.0

Add-TimeSpan

SYNOPSIS

Adds a timespan to DateTime values.

SYNTAX

Add-TimeSpan [-TimeSpan] <TimeSpan> [-DateTime] <DateTime> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

This is a more PowerShell-idiomatic, pipeline-based way to add a timespan to a datetime.

EXAMPLES

EXAMPLE 1

Get-Date |Add-TimeSpan 00:00:30

Adds 30 seconds to the current date and time value.

PARAMETERS

-TimeSpan

The TimeSpan value to add.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DateTime

The DateTime value to add to.

Type: DateTime
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.DateTime values to add the TimeSpan value to.

OUTPUTS

System.DateTime values with the TimeSpan added.

NOTES

RELATED LINKS

Clone this wiki locally