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:
The ODBC spec for the DAYOFWEEK function says that Sunday is Day 1 and Saturday is Day 7.
Jews and Christians agree that the first Sabbaththe "seventh day" on which God restedwas Saturday.
The German word for Wednesday, Mittwoch, means midweek.
The arguments for Monday are these:
The ISO 8601 standard says that Monday is Day 1 and Sunday is Day 7.
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.