weekday

Applies weekday N modifier to a date/time value.

This function translates to the 'weekday N' modifier in SQLite's date and time functions. It moves the date forward to the next day that is the specified weekday. If the current date is already that weekday, it advances to the next week's occurrence.

The weekday parameter uses the following integer mapping:

  • 0: Sunday

  • 1: Monday

  • 2: Tuesday

  • 3: Wednesday

  • 4: Thursday

  • 5: Friday

  • 6: Saturday

Example

// Assuming today is '2024-07-15' (a Monday)

// Find the next Sunday
// Result: '2024-07-21'
select(DATE().now().weekday(0)).execute()

// Find the next Monday (will be next week's Monday)
// Result: '2024-07-22'
select(DATE().now().weekday(1)).execute()

Return

A KQLiteColumn with the 'weekday N' modifier applied.

Author

MOHAMMAD AZIM ANSARI

Parameters

weekday

An integer representing the day of the week (0=Sunday, 1=Monday, ..., 6=Saturday).

See also