calander
-
- Posts: 209
- Joined: Thu Oct 19, 2006 11:46 am
- Location: Bakewell, UK
- Has thanked: 20 times
- Been thanked: 16 times
Leap Year
The hard way is to code the following
The Gregorian calendar, the current standard calendar in most of the world, adds a 29th day to February in all years evenly divisible by 4, except for centennial years (those ending in -00), which receive the extra day only if they are evenly divisible by 400.
However, unless you seriously expect your project to still be running in 20 years time then it may be easier to code for the actual years:
2000/04/08/16/20 (???)
So
If Month = 2 (Feb) and Year = 2004 then month = month + 1 when days = 29
If Month = 2 (Feb) and Year = 2008 then month = month + 1 when days = 29 etc
(see related post on calendar)
The calculation route should be easier in C within flowcode as boostC seems to have some good features to find remainders from division calculations and can use 16 bit numbers)
Or can Flowcode 3 find if a remainder is 0 (i.e. exact division) within 16 bit calculations now?
The Gregorian calendar, the current standard calendar in most of the world, adds a 29th day to February in all years evenly divisible by 4, except for centennial years (those ending in -00), which receive the extra day only if they are evenly divisible by 400.
However, unless you seriously expect your project to still be running in 20 years time then it may be easier to code for the actual years:
2000/04/08/16/20 (???)
So
If Month = 2 (Feb) and Year = 2004 then month = month + 1 when days = 29
If Month = 2 (Feb) and Year = 2008 then month = month + 1 when days = 29 etc
(see related post on calendar)
The calculation route should be easier in C within flowcode as boostC seems to have some good features to find remainders from division calculations and can use 16 bit numbers)
Or can Flowcode 3 find if a remainder is 0 (i.e. exact division) within 16 bit calculations now?
Go with the Flow.