For definiton of duration of February in leap-year you can use
the following code:
if (Month() == 2 )
{if (MathMod(Year(),4)==0) DaysNum = 29; else DaysNum = 28;}
For definiton of duration of February in leap-year you can use
the following code:
if (Month() == 2 )
{if (MathMod(Year(),4)==0) DaysNum = 29; else DaysNum = 28;}Thanks for that a ton, answers my question with division, but just out of simple curiousity, why do you campare a 4'th year to 0?
Thanks for that a ton, answers my question with division, but just out of simple curiousity, why do you campare a 4'th year to 0?
Because function MathMod is:
double MathMod( double value, double value2)
The function returns the remainder of division of two numbers.
Parameters:
value - Dividend value.
value2 - Divisor value.
Thanks for that a ton, answers my question with division, but just out of simple curiousity, why do you campare a 4'th year to 0?
Because function MathMod is:
double MathMod( double value, double value2)
The function returns the remainder of division of two numbers.
Parameters:
value - Dividend value.
value2 - Divisor value.
If the remainder of division of two numbers is equal 0 the first are multiple to the second.
Shouldn't this be "every year that can be divided by 400 is a leap year"? I know that it isn't important now, but maybe over 394 years
actually, i meant what i said. according to this website, if it is divisible by 400 than it's not a leap year, here's the link, see for yourself.
actually, i meant what i said. according to this website, if it is divisible by 400 than it's not a leap year, here's the link, see for yourself. http://www.timeanddate.com/date/leapyear.html
Your link also says:
This means that year 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years, while year 2000 and 2400 are leap years.
Your link also says: This means that year 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years, while year 2000 and 2400 are leap years.
right, i overlooked that, i'm not exactly an expert on leap years.
well, i may be now, lol.
thanks for saving my skin, although it may be another 393.15 years, (guessing there).
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i'm working to program a counter that will count when the moon is full to automate when good friday occurs, and as i was flowing through my river of thought, i encountered a dam. the method i'm taking seems simple enough to me, i've just never worked with code this way before.
in order to count the months, it was crucial to reset the days as i went through the months, i found this simple enough when i thought about it for a second for every month with 30 or 31 days. and then i crossed the elusive february.
february has an additional day every leap year, which occurs, usually, every 4 years. there are three rules that govern a leap year specifically though, as i found on google.
1. Every year divisible by 4 is a leap year.
2. a leap year is not divisible by 100
3. a leap year is not divisible by 400
what i want to do is ask the computer to divde the year by 4 to see if it is an integer, and make sure you can't divide it by 100 or 400 and get an integer. here's the function i've made so far. and yes, i know, i have two unused arrays in it so far.
int goodfriday()
{
double cycledays = 29.5306;
int month = 11;
double day = 5;
bool FullMoon = False;
static double gmonth [2] = {0};
static double gday [31] = {0};
{
Month() = month && Day() = day && Year() = 2006 && FullMoon = True;
if (Month() == month && Day() == day + cycledays && Year == 2006)
{
FullMoon = True;
}
if ((Month() == 1 || Month() == 3 || Month() == 5 || Month() == 7 || Month() == 8 || Month() == 10 || Month() == 12) && day + cycledays > 31
{
month++;
day = day + cycledays - 31;
}
if ((Month() == 4 || Month() == 6 || Month() == 9 || Month() == 11) && day + cycledays > 30
{
month++;
day = day + cycledays - 30;
}
if ((Month() == 2 && Year() /*???*/) && day + cycledays > 28
{
month++;
day = day + cycledays - 28;
}
return(0);
}
}