Skip to content
ConsoleMonster
Cmdlet

Read-ConsoleDate

Module
ConsoleMonster
Inputs
System.Management.Automation.PSObject
Outputs
System.DateTime ConsoleMonster.Dates.DateRange

Asks for one civil date or inclusive date range.

Syntax

Read-ConsoleDate
[-Default <Object>]
[-Description <String>]
[-InputObject <PSObject>]
[-Mode <Rich|Line|Accessible>]
[-ParameterName <String>]
[-Range]
[-Selection <DateSelectionOptions>]
[-StaticSnapshot]
[-Title] <String>
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Returns one DateTime at midnight with unspecified kind, or one DateRange with -Range. Escape follows the normal prompt cancellation policy. Line and accessible modes accept yyyy-MM-dd and culture-aware dates; non-interactive mode requires a valid explicit default.

Examples

Example 1

Read-ConsoleDate -Title Window -Range -Default ([datetime]'2026-10-08')

Read an inclusive maintenance window.

Parameters

-Default Object optional
Default DateTime or DateRange, validated even in non-interactive mode.
-Description String optional
Help text under the question.
-InputObject PSObject optionalpipeline: True (ByValue)
Optional dated status records, using Date, Status and Label members.
-Mode InteractionMode optional
Forces how to ask: Rich (in-place prompt), Line (question and typed answer), Accessible (numbered, no redraws) or None (use the default or fail).
Possible values: Rich, Line, Accessible
-ParameterName String optional
The parameter of your script that supplies this value without a prompt (named in the non-interactive error, for example -Domain).
-Range SwitchParameter optional
Returns one inclusive DateRange.
-Selection DateSelectionOptions optional
Shared date bounds, culture, today and immutable marked-day model.
-StaticSnapshot SwitchParameter optional
Prints the initialized rich prompt without reading input or returning an answer. Useful for documentation and unattended previews.
-Title String requiredposition: 0
The question.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.