DAYOFWEEK

Purpose

This function allows you to retrieve the day of the week from DATE and TIMESTAMP.

The output is an integer based on the session parameter NLS_FIRST_DAY_OF_WEEK, which defaults to Sunday as the first day of week.

Syntax

dayofweek::=

syntax

Usage notes

  • The function takes a single parameter which can be DATE, TIMESTAMP, or TIMESTAMP WITH LOCAL TIME ZONE.

  • The function returns the numerical value of the day of the week from 1 = Sunday, 2 = Monday, … 7 = Saturday when NLS_FIRST_DAY_OF_WEEK = Sunday.

Example

Copy
SELECT DAYOFWEEK(DATE '2025-10-01'); 

DAYOFWEEK(TO_DATE('2025-10-01','YYYY-MM-DD'))

4