I have two fields in a particular opportunity. One is the "Proposal Sent Date" which is automatically entered when the user generates the proposal (via Conga Composer). I also have the "Proposal Valid Thru Date" which should be 1 month (or 31 days for simplicity) after the Proposal Sent Date. HOWEVER, this valid thru date cannot be on the weekend.

My question is, how can I turn:

Proposal Valid Thru Date (Date)=

Proposal_Sent_Date__c + 31

Into a field that will push the date 2 days forward if it is a Saturday, and 1 day forward if it is a Sunday?

For instance, If I ran that report today, the sent date is 5/4/2017 but the Valid date is 6/4/2017 which is a Sunday. I need that to know 6/4/2017 is a Sunday and to add a day to make the valid thru date 6/5/2017 which is Monday

I am looking for my answer to be solved directly in the Formula Field.

  • 1
    There are a bunch of answers for these question in the internet. I got some and added a answer for you. I sure that it will answer your question. Please, next time, search a little bit more.
    – m Peixoto
    May 4, 2017 at 18:33

1 Answer 1


Here in this link you can see how you could add one month for a date:

date myDate = date.newInstance(1990, 11, 21);
date newDate = myDate.addMonths(1);

Here, you can check how to test if it is a weekend:

// Cast the Date variable into a DateTime
DateTime myDateTime = (DateTime) myDate;
String dayOfWeek = myDateTime.format('E');
// dayOfWeek is Sun, Mon, Tue, etc.

So, if the new Date will be a weekend, you must add more one day. You should do it in a loop because if is Saturday, you should add more one day. Or you can test: If it is saturday, add 2 days. If it is Sunday, add 1 day.

  • What part of my initial question would allow you to assume that I can simply write it. I clearly put what is defined in the formula field and that is VERY basic. I cannot take what you gave me and get a correct answer. I am here because I HAVE searched a bunch on the internet and was unable to find something that I am able to use to solve my problem given my experience.
    – Tim R
    May 4, 2017 at 18:39
  • You should edit your question and say that you want a formula field and not an apex code. Your question is generic and it is a possible solution.
    – m Peixoto
    May 4, 2017 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .