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.
pconpcon
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
pconpcon
If you are doing this for the Trailhead formula, there is a known issue in the module that they should be fixing "soon"

https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?fId=0D53000002QsY2p&g=0F9300000009Nek (https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?fId=0D53000002QsY2p&g=0F9300000009Nek)
Yi Tan- CherryYi Tan- Cherry
Hi 

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: []
RAJA SEKHAR CHALLARIRAJA SEKHAR CHALLARI
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".