public
Created

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.

  • Download Gist
Get-DaysLeft
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$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.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.