Create a gist now

Instantly share code, notes, and snippets.

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:
# 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