0
I need to know from the user’s birth date, if he was born in the period of the military dictatorship.
The military period in Brazil began on 04/01/1964 and ended on 03/15/1985, and all who were born between this period would be treated as true, the before and after the period would be treated as false.
I’m trying this way, but I’m missing something
Function ditadura(data)
d = day(data)
m = month(data)
a = year(data)
if a >= 1964 and m >= 04 and d >= 01 or a <= 1985 and m <= 03 and d <= 15 then
ditadura = "Você nasceu em um período de ditadura militar"
end if
end function
How can I fix this?
The code is good, but there’s a mistake: it should be
If data>= inicio And data <= fim Then
– Sam
yes truth well aimed @dvd, I will fix
– Ricardo Pontual
Thanks friend, but it did not work, I checked the format and this correct, but when I type the date 17/10/1983 that was in the period, it is not informed that I was born in the dictatorship, not going, tested exactly as you posted and did not go, where can I be missing? you took the test? it was all ok?
– Patrique
Are you sure the date shape is correct?
– Ricardo Pontual
I believe the problem is the format d/m/a, tried with m/d/a? I made a fiddle, a little different because it is in Vb.Net, but the logic is the same, and I did several tests and worked perfectly, including with 17/10/1983. I had to use the date format M/D/A, see here: https://dotnetfiddle.net/1NaBhL
– Ricardo Pontual
Funfou mano, after testing here, I checked that the date of birth has to be in the format d/m/a the others are in the format d/m/a I will treat here and fix it, thank you very much for the help!
– Patrique