Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » CalendarCtrl » Setting FirstDay puts day numbers out of alignment with day names
Setting FirstDay puts day numbers out of alignment with day names [message #35637] Fri, 09 March 2012 05:40 Go to previous message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 220
Registered: June 2011
Experienced Member
I made the following changes so that when FirstDay is changed, the calendar days will realign themselves to their names. Having tested Sat-Friday, it appears to work.

I don't know how this affects the week numbers, though, because my math with date time calculation is not too good:

int	Calendar::DayOfWeek(int day, int month, int year, int zelleroffset)
{
	if(month < 3)
	{
		month += 12 ;
		year -= 1 ;
        }

	int n1 = (26 * (month + 1)) / 10;
	int n2 = (125 * year) / 100;

	return ((day + (8 - first_day) + n1 + n2 - (year / 100) + (year / 400) - zelleroffset) % 7 );
} 

[Updated on: Fri, 09 March 2012 05:45]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DropTime and WhenAction() problem
Next Topic: [Minor bug & patch] CalendarCtrl should offer support for native cursor icon.
Goto Forum:
  


Current Time: Sun Apr 28 15:26:01 CEST 2024

Total time taken to generate the page: 0.02630 seconds