How to display date in simple format on Visualforce email template?

BY docmation December 22, 2014

The format of date appearing on Visualforce email template corresponding to the field “date” displays the date in the format “Wed Nov 12 00:00:00 GMT 2014”. To display the date in a more simpler and a rather standard format, a formula can be used in the “date” field. This option of using the formula allows the users to have greater flexibility in viewing the date in a simple form that is easier to comprehend at the first look.

  • In order to implement the formula to display date in a simple format, a new custom formula field of type “text” has to be created in the object.
  • The next step is to add the below mentioned formula –
    TEXT(DAY(Date Field Name))&”- “&CASE(MONTH(Date Field Name),1,”Jan”,2,”Feb”,3,”Mar”,4,”Apr”,5,”May”,6,”June”,7,”July”,8,”Aug”,9,”Sept”,10,”Oct”,11,” Nov”,”Dec”)&”-“&TEXT(YEAR(Date Field Name))
  • The above formula will display date in the format “12-Nov-2014”. Editing the above formula will help you get results in other similar formats.
  • You can display this formula field on the email template directly instead of displaying the “date” field.

Leave a Reply

Your email address will not be published. Required fields are marked *