external help file | Module Name | online version | schema |
---|---|---|---|
PSDates-help.xml |
PSDates |
2.0.0 |
Converts various input objects to a DateTime object.
Convert-ToDateTime [-InputObject] <Object> [-ProgressAction <ActionPreference>] [<CommonParameters>]
The Convert-ToDateTime
function attempts to convert different types of input objects into a DateTime object.
It supports input from various data types such as strings and objects that can be cast or converted to a DateTime.
'2024-08-29' | Convert-ToDateTime
Converts the string '2024-08-29' into a DateTime object representing the 29th of August, 2024.
Specifies the input object to be converted to a DateTime. This parameter accepts pipeline input and is mandatory.
The input can be of any type:
- If the input is already a DateTime, it will be returned as-is.
- If the input is a string, it attempts to parse it into a DateTime.
- Other input types will be processed accordingly, if possible.
Type: Object
Parameter Sets: (All)
Aliases:
Accepted values:
Required: True (All) False (None)
Position: 0
Default value:
Accept pipeline input: True
Accept wildcard characters: False
DontShow: False
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Accepted values:
Required: True (None) False (All)
Position: Named
Default value:
Accept pipeline input: False
Accept wildcard characters: False
DontShow: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
The function accepts objects from the pipeline, which are attempted to be converted to DateTime.
The function outputs a DateTime object if the conversion is successful.
Fill Related Links Here