Skip to content

Tell-NewYear

Tells the time until New Year

try {
	$now = [DateTime]::Now
	$NewYear = [Datetime]("12/31/" + $now.Year)
	$days = ($NewYear ? $now).Days + 1
	if ($days -gt 1) {
		& "$PSScriptRoot/speak-english.ps1" "New Year is in $days days."
	}
 elseif ($days -eq 1) {
		& "$PSScriptRoot/speak-english.ps1" "New Year is tomorrow."
	}
	exit 0 # success
}
catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.