My son asked me how many days there were until next Christmas.

I didn’t know – but knew a way to find out – PowerShell to the rescue, again!

I know there are better ways to get this output, and I also know that ‘Write-Host’ is the work of the devil himself, but hey-ho, it’s Christmas (well, sort of) so the rules are different.

Function Get-NumberOfDaysUntilNextChristmas { If ((([DateTime]::Now).DayOfYear) -gt 360) { $MerryChristmas = ([DateTime]("12/25/" + ((([DateTime]::Now).Year)+1)) - [DateTime]::Now).Days } Else { $MerryChristmas = ([DateTime]("12/25/" + (([DateTime]::Now).Year))- [DateTime]::Now).Days } Write-Host "There are $MerryChristmas days until next Christmas!" } Get-NumberOfDaysUntilNextChristmas

more to follow…