DayNumber

Description

Gets the day of the week of a date value and returns the number of the weekday.

Syntax

DayNumber ( date )

Argument

Description

date

The date from which you want the number of the day of the week


Return value

Integer. Returns an integer (1-7) representing the day of the week of date. Sunday is day 1, Monday is day 2, and so on.

Examples

This expression for a computed field returns Wrong Day if the date in start_date is not a Sunday or a Monday:

If(DayNumber(start_date) > 2, "Okay", "Wrong Day")

This expression for a computed field returns Wrong Day if the date in end_date is not a Saturday or a Sunday:

If(DayNumber(end_date) > 1 and DayNumber(end_date) 
< 7, "Okay", "Wrong Day")

This validation rule for the column end_date ensures that the day is not a Saturday or Sunday:

DayNumber(end_date) >1 and DayNumber(end_date) < 7

See also

Date

Day

DayName

IsDate

DayNumber in the section called “DayNumber” in PowerScript Reference