+ Start a Discussion
S b 25S b 25 

need to exclude weekends using validation rule

Hi, I want to exclude validation rule to fire when users enter any weekend date for a date field.

Any suggestions would help. 

Thanks in advance.
Best Answer chosen by S b 25
Steven NsubugaSteven Nsubuga
Try this. Assuming that Date__c is the field 

OR(MOD(Date__c - DATE( 1900, 1, 7 ), 7 ) == 0, MOD(Date__c - DATE( 1900, 1, 7 ), 7 ) == 6)

All Answers

Steven NsubugaSteven Nsubuga
Try this. Assuming that Date__c is the field 

OR(MOD(Date__c - DATE( 1900, 1, 7 ), 7 ) == 0, MOD(Date__c - DATE( 1900, 1, 7 ), 7 ) == 6)
This was selected as the best answer
S b 25S b 25
@steven, It works perfectly fine, thanks :)
S b 25S b 25
Hello @Steven

I have one small query, can you let me know what 1900 means in the validation rule ?

Thanks
Steven NsubugaSteven Nsubuga
It represents a date in the past, DATE( 1900, 1, 7 ) is the date 1 January 1900. Usually such dates are picked to make it easy to calculate other dates.