Skip to content

check-independence-day

Checks the time until Independence Day

#Requires -Version 5.1

try {
	$Now = [DateTime]::Now
	$IndependenceDay = [Datetime]("07/04/" + $Now.Year)
	if ($Now -lt $IndependenceDay) {
		$Diff = $IndependenceDay – $Now
		& "$PSScriptRoot/speak-english.ps1" "Independence Day on July 4th is in $($Diff.Days) days."
	} else {
		$Diff = $Now - $IndependenceDay
		& "$PSScriptRoot/speak-english.ps1" "Independence Day on July 4th was $($Diff.Days) days ago."
	}
	exit 0
} catch {
throw
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.