Getting the day of the week using Formulas

If you need to get the day of the week using formulas in Salesforce you can use the following:

MOD( CustomDate__c - DATE(1900, 1, 7), 7)

The output will be a number from 0 to 6 with the following meaning:

0 = Sunday 1 = Monday 2 = Tuesday 3 = Wednesday 4 = Thursday 5 = Friday 6 = Saturday

You can then use the following to generate the actual word:

CASE(MOD( CustomDate__c - DATE(1900, 1, 7), 7) , 0 , 'Saturday' , 1 , 'Sunday' ,  2 , 'Monday' , 3 , 'Tuesday' , 4 , 'Wednesday' , 5 , 'Thursday' , 6 , 'Friday'  , '')