Loading

Render Date fields in a certain format in Visualforce HTML email templates

Date de publication: Oct 13, 2022
Description
When creating a Visualforce HTML email template,  including a Date field (as opposed to a Date/Time field) using a merge field such as {!relatedTo.Custom_Date__c}, the date will be in the following format: 

 Mon Oct 22 00:00:00 GMT 2018

You want the date to instead be formatted without time or timezone information;  e.g. DD/MM/YYYY
Résolution
You can use standard formulas to extract just the date into the format you want. Following is as example:
{!DAY(relatedTo.VFDateTest__c)}/{!CASE(MONTH(relatedTo.VFDateTest__c),1,"01/",2,"02/",3,"03/",4,"04/",5,"05/",6,"06/",7,"07/",8,"08/",9,"09/",10,"10/",11,"11/",12,"12/","??/")}{!YEAR(relatedTo.VFDateTest__c)}
which will show as DD/MM/YYYY

Reference: 
Numéro d’article de la base de connaissances

000385770

 
Chargement
Salesforce Help | Article