Get the First, Second, Third, or Fourth Monday of a Year in SQLite

We can use SQLite’s DATE() function to return the first, second, third, fourth, etc instance of a given day within a given year.

We can use the same technique to return the first Monday of each month in the year.

It’s not limited to Monday though. The same techniques can be used on Tuesday, Wednesday, Thursday, Friday, etc.

Example

Here’s an example to demonstrate:

SELECT 
    DATE('2025-10-20', 'start of year', 'weekday 1') AS "First",
    DATE('2025-10-20', 'start of year', '+7 days', 'weekday 1') AS "Second",
    DATE('2025-10-20', 'start of year', '+14 days', 'weekday 1') AS "Third",
    DATE('2025-10-20', 'start of year', '+21 days', 'weekday 1') AS "Fourth",
    DATE('2025-10-20', 'start of year', '+28 days', 'weekday 1') AS "Fifth";

Result:

First       Second      Third       Fourth      Fifth     
----------  ----------  ----------  ----------  ----------
2025-01-06  2025-01-13  2025-01-20  2025-01-27  2025-02-03

In this example, we call the DATE() function five times. We use the same date each time, and most of the arguments are the same. The only thing that changes is how much we add to the start of the year. When we don’t add anything, we return the first Monday, adding 7 days returns the second Monday, and so on.

Here, we use start of year to return the date back to the first day of the year. We then use additional modifiers to modify that date accordingly.

The weekday 1 modifier moves the date forward to the next Monday. Sunday is 0, Monday is 1, Tuesday is 2, and so on, so if we wanted Tuesday for example, we’d use weekday 2 instead.

To get the second Monday we use +7 days to advance the date forward by a week. For subsequent Mondays we add 7 days to that number (+14 days, +21 days, +28 days etc).

We can also see that adding 28 days returns the first Monday of the following month.

First Monday of Each Month

We can alternatively use code like the following to return the first Monday of each month throughout the year:

SELECT 
    DATE('2025-10-20', 'start of year', 'weekday 1') AS "Jan",
    DATE('2025-10-20', 'start of year', '+1 month', 'weekday 1') AS "Feb",
    DATE('2025-10-20', 'start of year', '+2 months', 'weekday 1') AS "Mar",
    DATE('2025-10-20', 'start of year', '+3 months', 'weekday 1') AS "Apr",
    DATE('2025-10-20', 'start of year', '+4 months', 'weekday 1') AS "May";

Result:

Jan         Feb         Mar         Apr         May       
----------  ----------  ----------  ----------  ----------
2025-01-06  2025-02-03  2025-03-03  2025-04-07  2025-05-05

We can add more months simply by using +5 months, +6months, and so on.