Hello

Calendar and Dates – Types of Problems

Finding the Day of the Week for a Given Date – Type 1

Concept Explanation:

 The day of the week for any given date can be found using various methods, including Zeller’s Congruence, the Doomsday Algorithm, or simple arithmetic methods involving key anchor days. A common approach is to use a formula based on the day, month, and year to calculate the day of the week.

Formula: For the Gregorian calendar, Zeller’s Congruence is a popular formula:

$$
h = \left( q + \left\lfloor \frac{13(m+1)}{5} \right\rfloor + K + \left\lfloor \frac{K}{4} \right\rfloor + \left\lfloor \frac{J}{4} \right\rfloor – 2J \right) \mod 7
$$

Where:

        – $h$ = Day of the week (0 = Saturday, 1 = Sunday, 2 = Monday, …, 6 = Friday)
        – $q$ = Day of the month
        – $m$ = Month (3 = March, 4 = April, …, 12 = December; January and February are counted as months 13 and 14 of the previous year)
        – $K$ = Year of the century (year % 100)
        – $J$ = Zero-based century (actually $\left\lfloor \frac{year}{100} \right\rfloor$)

Solved Problem – Type 1

Example: Find the day of the week on 23rd August 2024.

Solution:

1. Convert the date:

          – $q = 23$
          – $m = 8$
          – Since August is the 8th month, we don’t change the year.
          – $K = 24$ (since $2024 \% 100 = 24$)
          – $J = 20$ (since $\left\lfloor \frac{2024}{100} \right\rfloor = 20$)

2. Plug the values into the formula:

$$
h = \left( 23 + \left\lfloor \frac{13(8 + 1)}{5} \right\rfloor + 24 + \left\lfloor \frac{24}{4} \right\rfloor + \left\lfloor \frac{20}{4} \right\rfloor – 2 \times 20 \right) \mod 7
$$

3. Calculate each term:

$$
h = \left( 23 + \left\lfloor \frac{117}{5} \right\rfloor + 24 + 6 + 5 – 40 \right) \mod 7
$$

$$
h = (23 + 23 + 24 + 6 + 5 – 40) \mod 7
$$

$$
h = (41) \mod 7
$$

$$
h = 6
$$

4. Determine the day of the week: $h = 6$ corresponds to Friday.

Answer: 23rd August 2024 is a Friday.

Calculating the Number of Days Between Two Dates – Type 2

Concept Explanation: 

To calculate the number of days between two dates, consider both dates in their entirety. The difference is usually found by converting both dates to a serial date number (the number of days from a specific reference date) and subtracting the two numbers.

Formula:

$$
\text{Number of Days} = \text{Date2} – \text{Date1}
$$

Where Date1 and Date2 are in a serial format (e.g., Julian date, which is often used in astronomy).

Example: Calculate the number of days between 15th March 2023 and 10th August 2023.

Solution:

1. List out the days in each month:

        – From 15th March to 31st March: 16 days (since $31 – 15 + 1$)
        – April: 30 days
        – May: 31 days
        – June: 30 days
        – July: 31 days
        – From 1st August to 10th August: 10 days

2. Add the days:

$$
\text{Total days} = 16 + 30 + 31 + 30 + 31 + 10 = 148
$$

Answer: There are 148 days between 15th March 2023 and 10th August 2023.

Determining the Day Count for a Given Month – Type 3

Concept Explanation: 

Each month in the Gregorian calendar has a specific number of days: 28 or 29 (February, depending on leap years), 30, or 31. Knowing the specific number of days helps in calculating differences or planning.

Formula: To check if a year is a leap year:

$$
\text{Leap Year} =
\begin{cases}
\text{True, if} & \text{year} \% 4 == 0 \text{ and } (\text{year} \% 100 \neq 0 \text{ or } \text{year} \% 400 == 0) \\
\text{False, otherwise} &
\end{cases}
$$

Example: How many days are there in February 2020?

Solution:

1. Check if 2020 is a leap year:

         – $2020 % 4 = 0$ (divisible by 4)
         – $2020 % 100 = 20$ (not divisible by 100)
         – Since it passes the leap year test (divisible by 4 and not by 100), 2020 is a leap year.

2. Days in February during a leap year: 29 days.

Answer: February 2020 has 29 days.

Calculating Future or Past Days Given a Current Day – Type 4

Concept Explanation: 

To determine a future or past day from a given day, add or subtract days and account for the modulo operation to cycle through the week.

Formula:

$$
\text{Future Day} = (\text{Current Day} + \text{Days Ahead}) \mod 7
$$

$$
\text{Past Day} = (\text{Current Day} – \text{Days Behind} + 7) \mod 7
$$

Where day codes are: Sunday = 0, Monday = 1, …, Saturday = 6.

Example: If today is Wednesday, what day will it be 45 days from now?

Solution:

1. Assign numerical value to Wednesday:

         – Wednesday = 3

2. Use the formula for future day:

$$
\text{Future Day} = (3 + 45) \mod 7
$$

$$
\text{Future Day} = 48 \mod 7 = 6
$$

3. Determine the day corresponding to 6:

         – 6 corresponds to Saturday.

Answer: 45 days from Wednesday will be a Saturday.

Finding the Day of the Week After a Certain Number of Days – Type 5

Type 5: Finding the Day of the Week After a Certain Number of Days

Concept Explanation:

To find the day of the week after a certain number of days from a given date, we use modular arithmetic. The idea is to add the given number of days to the current day and then take the modulus with 7 (since there are 7 days in a week).

Formula:

$$
\text{Future Day} = (\text{Current Day} + \text{Number of Days Ahead}) \mod 7
$$

Where the days of the week are assigned numerical values:

       – Sunday = 0
       – Monday = 1
       – Tuesday = 2
       – Wednesday = 3
       – Thursday = 4
       – Friday = 5
       – Saturday = 6

Solved Problem – Type 5

Example: If today is Monday, what day will it be 100 days from now?

Solution:

1. Assign numerical value to Monday:

         – Monday = 1

2. Use the formula to find the future day:

$$
\text{Future Day} = (1 + 100) \mod 7
$$

$$
\text{Future Day} = 101 \mod 7
$$

3. Calculate the modulo operation:

$$
101 \mod 7 = 3
$$

4. Determine the day corresponding to 3:

         – 3 corresponds to Wednesday.

Answer: 100 days from Monday will be a Wednesday.

Determining the Date of a Specific Day in a Given Year – Type 6

Concept Explanation: To find the date of a specific day (like the nth Sunday) in a given year, you need to know the day of the week of the 1st of January of that year and use arithmetic to reach the target date.

Formula:

1. Calculate the day of the week of the 1st of January of the given year.
2. Use the formula:

$$
\text{Date} = (n – 1) \times 7 + \text{Day Difference}
$$

where $n$ is the nth occurrence of the day in the month and Day Difference is the difference in days between the 1st of the month and the target day of the week.

Example: Find the date of the 3rd Thursday in March 2025.

Solution:

1. Determine the day of the week on 1st March 2025:

          – We first find the day of the week for 1st March 2025.
          – 1st January 2025 is a Wednesday (assuming known or previously calculated).
          – March 1st is 59 days after January 1st (31 days in January + 28 days in February in a non-leap year).
          – Days count modulo 7: $59 \mod 7 = 3$. Adding 3 days to Wednesday gives Saturday.
          – So, 1st March 2025 is a Saturday.

2. Calculate the date of the 3rd Thursday:

          – The first Thursday of March 2025 is on 6th March (the first Thursday after 1st March).
          – The third Thursday is $6 + 14 = 20$ (14 days after the first Thursday).

Answer: The 3rd Thursday in March 2025 is 20th March 2025.

Calculating the Number of Odd Days Between Two Dates – Type 7

Concept Explanation: The concept of “odd days” refers to the number of days more than the complete weeks in a given period. The calculation of odd days helps in finding the day of the week for large intervals.

Formula:

1. Calculate the total number of days between two dates.
2. Find the remainder when the total number of days is divided by 7:

$$
\text{Odd Days} = \text{Total Days} \mod 7
$$

Example: Calculate the number of odd days between 1st January 2000 and 31st December 2024.

Solution:

1. Calculate the number of days in each year:

          – 2000 to 2024 includes 6 leap years (2000, 2004, 2008, 2012, 2016, 2020).
          – Non-leap years: 19 years – 6 leap years = 13 non-leap years.

2. Calculate the total number of days:

          – Leap years: $6 \times 366 = 2196$ days
          – Non-leap years: $13 \times 365 = 4745$ days
          – Total days = $2196 + 4745 = 6941$ days

3. Calculate the number of odd days:

$$
\text{Odd Days} = 6941 \mod 7 = 1
$$

Answer: There is 1 odd day between 1st January 2000 and 31st December 2024.

Calculating Day Differences Across Multiple Years – Type 8

Concept Explanation:

When calculating the difference in days between two dates across multiple years, it’s important to account for both leap and non-leap years. This type of problem often involves counting days month by month, considering each year.

Formula:

          1. Calculate days for each partial year.
          2. Account for leap and non-leap years.
          3. Sum total days to find the difference.

Solved Problem – Type 8

Example: Calculate the number of days between 25th December 2019 and 15th April 2022.

Solution:

1. Break the calculation into parts:

          – From 25th December 2019 to 31st December 2019: $31 – 25 + 1 = 7$ days
          – Full years: 2020 and 2021
          – 2020: Leap year = 366 days
          – 2021: Non-leap year = 365 days
          – From 1st January 2022 to 15th April 2022:
          – January: 31 days
          – February: 28 days (2022 is not a leap year)
          – March: 31 days
          – April: 15 days

2. Sum the days:

          – Days in 2019: 7 days
          – Days in 2020 and 2021: $366 + 365 = 731$ days
          – Days in 2022: $31 + 28 + 31 + 15 = 105$ days
          – Total days = $7 + 731 + 105 = 843$ days

Answer: There are 843 days between 25th December 2019 and 15th April 2022.

Finding a Specific Date Based on Day of the Week Rule – Type 9

Concept Explanation: 

Some problems require finding a specific date given certain rules about the day of the week. For example, finding the last Friday of a month.

Formula:

1. Calculate the day of the week for the 1st of the given month.
2. Identify the last occurrence of the desired day by adding weeks.

Example: Find the date of the last Friday in November 2023.

Solution:

1. Determine the day of the week on 1st November 2023:

          – Using Zeller’s Congruence or a known reference, assume 1st November 2023 is a Wednesday.

2. Calculate the day of the first Friday:

          – 1st November is a Wednesday, so the first Friday is 3rd November (Wednesday to Friday is 2 days ahead).

3. Calculate the last Friday:

          – November has 30 days. Calculate all Fridays: 3rd, 10th, 17th, 24th.
          – The last Friday is 24th November.

Answer: The last Friday in November 2023 is on 24th November.