One person’s 12/25/12 is another’s 2012-12-25. And just a small tweak to the month-day-year formula (%m %d %y) sets dates to appear just as you want them in your documents or templates.

For all formats, begin and end with {{ }}, and use lowercase for your variable names.

You can format dates in the following ways.

If you want dates to read like this—12/25/2012—do this:

Input {{ opportunity_to_close__c.to_formatted_date(“%m/%d/%Y”) }} Note that the uppercase Y gives you a four-digit year.

For dates with a two-digit year—12/25/12—simply change that capital Y to a lowercase y. Your final input looks like this:{{ opportunity_to_close__c.to_formatted_date(“%m/%d/%y”) }}

Each of the above examples forces a two-digit month and date. If you prefer single digits when appropriate (3/6/2016), input this:

{{ opportunity_close_date__c.to_formatted_date(“%-m/%-d/%Y”) }}

If you prefer hyphens, no problem, and you can also change the order in which your dates appear. To get 2016-06-03, for example, input the following:

{{ opportunity_close_date__c.to_formatted_date(“%Y-%m-%d”) }}

Finally, if you want the full day, month, date, and year, it can be yours. Input the following:

{{ opportunity_close_date__c.to_formatted_date(“%A, %B %-d, %Y”) }}

A gives you the full weekday name; B cues the full month name. Your result will be Sunday, March 6, 2016.

Did this article help?

Please provide us your feedback below.

* How helpful was this article?

If you have any additional questions and would like to be contacted by a member of our support team, please provide your email.