The Afro Coder

iSeries DB2 SQL First Day of the Week

On the iSeries we will use the sysibm/sysdummy1 file to perform the example calculation.

In my experience sometimes I needed to know the first day of the week based on a current date.

Most of the time the week would start on either Sunday or Monday (never on a Friday!)

Here is a select statement to get the current date

select
      current date
from
      sysibm/sysdummy1

That gives me today’s date

today-date

I can also get the day of the week represented as a number

select …
READ MORE