Skip to content

Instantly share code, notes, and snippets.

@pohatu
Created September 4, 2013 19:15
Show Gist options
  • Save pohatu/6441509 to your computer and use it in GitHub Desktop.
Save pohatu/6441509 to your computer and use it in GitHub Desktop.
Get-DaysLeft will tell you how many days you have left to live for various life expectancies. 100 is a nice round number. 82 is a good long life. 76 is the current life expectancy for the US. 65 is not uncommon.
$today = (Get-Date)
$bday = $(
$DOB = Read-Host "What is your birthday?"
if ($DOB){ $(get-date ($DOB)) }else{$(get-date)} #Default to today to avoid errors when nothing is entered.
)
write-host "You were born on $($bday.ToLongDateSTring())."
write-host "You have lived $(($today - $bday).Days) days."
100,82,76,65|%{ write-host "If you live to be $_ years old, then you have"(( $bday.AddYears($_) ) - $today).Days "days left to live."}
Write-Host "Make the most of them!"
Write-Host "But remember, there is only now."
# Credits:
# Lucy for asking how many days old she was on her birthday.
# Read-Host trick courtesy of Robert: http://social.technet.microsoft.com/Forums/windowsserver/en-US/6f3b8b60-78e1-4f4a-9499-e260a16509d8/readhost-default-value
# May this motivate you more than it depresses you. Remember only humans track time, everything else lives in the present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment