Get-CurrentDateTime¶
SYNOPSIS¶
Returns the current date and time in a specified format.
SYNTAX¶
__AllParameterSets¶
Get-CurrentDateTime [[-Format] <string>] [[-CustomFormat] <string>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Returns the current date and time formatted according to the specified format string. Supports common format presets or custom format strings. The Short and Long presets follow the current culture of the calling session, while ISO8601 is culture-invariant.
EXAMPLES¶
EXAMPLE 1¶
Get-CurrentDateTime
Returns the current date and time in the default format (yyyy-MM-dd HH:mm:ss).
EXAMPLE 2¶
Get-CurrentDateTime -Format 'Short'
Returns the current date in short date format.
EXAMPLE 3¶
Get-CurrentDateTime -Format 'Custom' -CustomFormat 'dddd, MMMM dd, yyyy'
Returns the current date in a custom format like "Monday, January 20, 2026".
PARAMETERS¶
-CustomFormat¶
Custom format string when Format is set to 'Custom'.
Type: System.String
DefaultValue: yyyy-MM-dd HH:mm:ss
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Format¶
The format preset to use for the date and time output.
Type: System.String
DefaultValue: Default
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
OUTPUTS¶
System.String¶
{{ Fill in the Description }}