Vinod Sebastian – B.Tech, M.Com, PGCBM, PGCPM, PGDBIO

Hi I'm a Web Architect by Profession and an Artist by nature. I love empowering People, aligning to Processes and delivering Projects.

Advertisements




The Day Formula

Have you ever wondered if your next birthday will be on a weekend? Discover a magical formula that can help you determine the day on which a specific date falls!

The Formula

The day of the week for a given date can be calculated using the following formula:

D = ( [23/9 * m] + d + 4 + y + [z/4] – [z/100] + [z/400] – 2 {if m >= 3} ) mod 7

Where:

  • D represents the value of the day. D = 0 means Sunday, D = 2 means Tuesday, and so on.
  • y is the year
  • m is the month
  • d is the day

If m is less than 3, then z = y – 1; otherwise, z = y.

The square brackets [] indicate that any fractional value after the decimal point should be ignored. The mod operation gives the remainder after division.

Example Calculation

Let’s calculate the day for February 28th, 2011:

Given: m = 3, d = 28, y = 2011

Plugging these values into the formula:

( [23/9 * 3] + 28 + 4 + 2011 + [2011/4] – [2011/100] + [2011/400] – 2 ) mod 7

Calculating this expression gives a result of 1, indicating that February 28th, 2011, falls on a Monday.

Understanding and utilizing this formula can be both fun and insightful!