Salesforce

How Do I Calculate the Day of the Week of a Date, as a Number? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Calculate the Day of the Week of a Date, as a Number? (Magic xpa 3.x)

Some programming you do may be tied to the day of the week. For instance, if paychecks are delivered on Friday, you will want to know if a given date is a Friday.

It is safer to check for the day of the week though, if it is displayed as a number. This reduces spelling and capitalization issues, and also, your application might be deployed in a country that speaks another language.

So, to check the day of the week of a given date, use the DOW() function.

Using DOW()

DOW(date) returns the day of the week, as a number between 1 (Sunday) and 7 (Saturday).

So in this example, since 19/08/2007 is a Sunday, DOW() returns the number 1.

Hint: If you need the day of the week as a string, use the CDOW() function.

See also

The Online and Rich Client Samples projects (program DT16 and RDT16)

Reference
Attachment 
Attachment