nodoid wrote > > The calling methods passes in month and year and expects back a list. > The idea is that it will put a 0 if the start of the week is not on > that > day (so for Feb, it should read 0,0,0,1 but it's coming out 0,1) >
The algorithm for calculating the date code for a given year is correct; but it only returns the date code for January 1st of that year, not any other month. To calculate the date code for any other month, get the date code for Jan 1st, and then sum up the number of days in each month until the month you are looking for, and then take the modulus of 7 and add ddc. Examples for 2012: ddc = 0 January 2012 has 31 days, to calculate the date code for February 2012 use: ddc + 31 % 7 = 3 You will have to account for leap years when doing this. To calculate July 2012, the process is the same; add all the days until July: ddc + 31 + 29 + 31 + 30 + 31 + 30 % 7 = 0 Hope that helps, otherwise the code looks straightforward and like it should work. Drew -- View this message in context: http://mono.1490590.n4.nabble.com/Console-calendar-tp4429854p4430386.html Sent from the Mono - General mailing list archive at Nabble.com. _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
