Tuesday, 15 December 2015

Adding One more day to Date field when its selected as Sunday



Adding One Day to the date field when the selected date is Sunday.

1) create a date field with label "Date", API : "Date__c"
2) create a formula field with any name for Ex. "Date1", API: "Date1__c"

Now copy and paste the following formula in the formula field.

Formula :

If((CASE(
MOD( Date__c - DATE( 1900, 1, 8 ), 7 ),
0, "Monday",
1, "Tuesday",
2, "Wednesday",
3, "Thursday",
4, "Friday",
5, "Saturday",
"Sunday"
))== "Sunday",Date__c+1,Date__c)



OutPut :

                         

No comments:

Post a Comment