New-CountdownDate.ps1
19 Sep 2025Description
Purpose
Creates a CountdownDate object and calculates the days left until the specified countdown date.
Detailed Description
The CountdownDate class represents a countdown date and provides a method to calculate the days left until the countdown date. The New-CountdownDate function creates a CountdownDate object and returns the countdown information.
Usage
Example 1
PS C:\> New-CountdownDate -CountdownDay "25/12/2022"
Returns the days left until Christmas Day (25th December 2022).
Example 2
PS C:\> New-CountdownDate -DaysUntilCountdown 30
Returns the days left until 30 days from the current date.
Notes
Author: Your Name Date: Today’s Date
Script
function New-CountdownDate {
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[string]$CountdownDay,
[Parameter(Mandatory = $false)]
[int]$DaysUntilCountdown
)
try {
$countdown = [CountdownDate]::new($CountdownDay, $DaysUntilCountdown)
return $countdown.GetCountdown()
}
catch {
Write-Error $_.Exception.Message
}
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.