The rdayofweek() function returns the day of the week as an integer value for an internal DATE.
The demo directory contains this sample program in the rdayofweek.ec file.