function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anne Clisham 26Anne Clisham 26 

Day of Week Formula.

I created a day of the week formula. It returned "Friday" but it is telling me that it is not calculating right. Today is Friday.
Can you please include the formula you are tryihng to use?  And the date field value you are trying to get the day of the week for?

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
Uvais KomathUvais Komath
CASE( MOD(  TODAY()  - DATE(1900, 1, 7), 7), 0, "Sunday", 1, "Monday", 2, "Tuesday", 3,
"Wednesday", 4, "Thursday", 5, "Friday", 6, "Saturday")
Try this
If you are doing this for the Trailhead formula, there is a known issue in the module that they should be fixing "soon" (
Yi Tan- CherryYi Tan- Cherry

I have same issue here. I am in GMT Time Zone, today's date is 3/10, it returns correctly as Thursday. but somehow, I can't pass the challenge. can you please advice?
here is my formula:
Case(MOD(Today()-DATE(1900,1,7),7),0,"Sunday",1,"Monday",2,"Tuesday",3,"Wednesday",4,"Thursday",5, "Friday",6,"Saturday", "Unknown") 
Pathma JemmyPathma Jemmy
This the error msg I am getting for using this formula "Case(MOD(Today()-DATE(1900,1,7),7),0,"Sunday",1,"Monday",2,"Tuesday",3,"Wednesday",4,"Thursday",5, "Friday",6,"Saturday", "Unknown")"

There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, No Email: []
The code or formula given by Uvais Komath will only work if you dont give "0" for sunday because there should be final else result in case syntax. that is why remove the case condition of 0 for sunday and use this code. it will work. 
CASE( MOD( TODAY() - DATE(1900, 1, 7), 7),  1, "Monday", 2, "Tuesday", 3, "Wednesday", 4, "Thursday", 5, "Friday", 6, "Saturday", "Sunday")
Nathan Riggs 4Nathan Riggs 4
It's because the date being used isn't correct.  The formula needs to show ...DATE(1900, 1, 6) 7)...January 6, 1900 is a Saturday and used as the reference date for this formula.
Edwin Schaeffer 11Edwin Schaeffer 11
In case anyone is reading this thread years later, this has all been solved by the "WEEKDAY" function. 1 = "Sunday" and 7 = "Saturday".