Home > Articles > Data

  • Print
  • + Share This
From the author of

Day of the Week

The majority of DBMSs have a function that returns the day of the week as a number. There is some dispute whether the first day is Sunday or Monday.

The arguments for Sunday are as follows:

  1. The ODBC spec for the DAYOFWEEK function says that Sunday is Day 1 and Saturday is Day 7.

  2. Jews and Christians agree that the first Sabbath—the "seventh day" on which God rested—was Saturday.

  3. The German word for Wednesday, Mittwoch, means midweek.

The arguments for Monday are these:

  1. The ISO 8601 standard says that Monday is Day 1 and Sunday is Day 7.

  2. Other bodies such as the BSI follow the ISO in this respect.

When no built-in function is available, you can use SQL's MOD function with the Julian Day Number as an argument.

  • + Share This
  • 🔖 Save To Your Account