Week start

In the past few days, I’ve been struggeling with something, that should be very elementary for any programmer. But I just couldn’t find the correct algorithm. It doesn’t make it easier, if PHP, the program language, I am using, is not consequent with international standards.

Let me try to explain without using terms and technical phrases. First, I have to explain, that when a programmer counts to ten, he (m/w) does not start with 1 but with 0. So 10 is the 11th number (that wasn’t too technical, was it?). According to ISO 8601 the first day of the week is Monday, and that should be number 0, where Tuesday should be number 1, Wednesday number 2, and so forth. That is not the case. In PHP, obviously, Sunday is number 0, Monday number 1, etc. etc.
Knowing that, it should be easy peasy to display a calendar starting with Monday.

However, some people insist of using Sunday as the first day in the week. My opinion is irrelevant. And rules, laws and standards are only made for those, whom cannot or does not want to behave themselves, and their victims. So I want to give the users of KairosPlanner the possibility to choose on what day their week is starting. And that became a bigger challenge for me than I ever thought.

I promised not to become technical, and I will (ofcourse) keep my promise. I only can tell you: I found a solution. Actually, it came to me while laying in my bed, just before I closed my eyes. Ofcourse, I forgot half of it in the night, but … I managed to reproduce my solution. So: KairosPlanner.com now can start on Monday or Sunday, whatever you choose. No, the calendar cannot start on Tuesday. Just because that makes no sense. I think. Or …?

Kind regards, and have a wonderful and effective day,

 

Albert

Leave a Comment