I am trying to make a VBScript code which will properly guess how many days until a person's birthday. Here is the code:
days = inputbox("What is your day of birth? (Numbers please)")
months = inputbox("What is your month of birth? (Numbers please)")
years = inputbox("What is your year of birth? (Numbers please)")
leapyear = inputbox("Is " & years & " a leap year? (Yes or no)")
if not isnumeric(days & months & years) then
msgbox("You may have entered a letter or a number from a foreign language. Latin numbers only.")
elseif isnumeric(days & months & years) then
a = months * 30 'broken line! please fix
if months = 1 then
a = a + 1
elseif months = 3 then
a = a + 1
elseif months = 5 then
a = a + 1
elseif months = 7 then
a = a + 1
elseif months = 8 then
a = a + 1
elseif months = 9 then
a = a + 1
end if
if leapyear = "yes" then
leapyear = true
elseif leapyear = "no" then
leapyear = false
end if
if months = 2 and leapyear = false then
a = a - 2
elseif months = 2 and leapyear = true then
a = a - 1
end if
b = msgbox("You have approximately " & a & " days until your birthday.")
end if
When run, it goes about 30-60 days off. Any formula or solution?