Created
February 17, 2015 07:23
-
-
Save realeroberto/4d6a2d32f3b25225decc to your computer and use it in GitHub Desktop.
How many days until Christmas?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# How many days until Christmas? | |
# | |
function DaysToXmas() | |
{ | |
$now = Get-Date | |
$Xmas = Get-Date -Day 25 -Month 12 | |
if ($now -gt $Xmas) { | |
$Xmas = Get-Date -Day 25 -Month 12 -Year ($now.Year + 1) | |
} | |
$diff = $Xmas.Subtract($now).Days | |
if ($diff -eq 0) { | |
Write-Host "Happy Christmas!" | |
} | |
return $diff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment