Skip to main content

dayNumber

dayNumber ( aDate : date ) : integer

ParameterTypeDescription
aDatedate->Date for which to return the number
Resultinteger<-Number representing the weekday on which date falls

Description

The dayNumber command returns a number representing the weekday on which aDate falls.

note

dayNumber returns 2 for null dates.

Qodly provides the following predefined constants:

ConstantTypeValue
Sundayinteger1
Mondayinteger2
Tuesdayinteger3
Wednesdayinteger4
Thursdayinteger5
Fridayinteger6
Saturdayinteger7
note

dayNumber returns a value between 1 and 7. To get the day number within the month for a date, use the command dayOf.

Example

The following example is a function that returns the current day as a string:

 var viDay : integer
var myResult: string
viDay = dayNumber(currentDate) // viDay gets the current day number
switch
:(viDay == 1)
myResult = "Sunday"
:(viDay == 2)
myResult = "Monday"
:(viDay == 3)
myResult = "Tuesday"
:(viDay == 4)
myResult = "Wednesday"
:(viDay == 5)
myResult = "Thursday"
:(viDay == 6)
myResult = "Friday"
:(viDay == 7)
myResult = "Saturday"
end

See also

dayOf