Is there a way to add months to a date inline on a visualforce page?

Something along {!quote.ExpirationDate.addMonths(3)} is what I was thinking about but I guess the syntax isn't accepted.

  • Why not create formula field, adding those months, and show that in VF page instead of normal field i.e ExpirationDate in your case ? – curious_techy Jun 22 '15 at 15:15
  • I could and that I've already done. This question is really just out of curiosity which can help those limited in the number of available fields in their SF orgs. – dotmiko Jun 22 '15 at 15:35

You can use MONTH formula to get no of the Month from your date

For printing the name of the month use below

{!CASE(MONTH(quote.ExpirationDate), 1, "January", 2, "February", 3, "March",  4, "April",  5, "May",  6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December", "None")}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.