1

I have a field on my opportunity which is a date. when I add it to my email template, it renders as date time. obviously, i want just the date to render.

Help?

<messaging:emailTemplate subject="This is my subject" recipientType="User" relatedToType="Opportunity">
    <messaging:htmlEmailBody >
        close Date: {!relatedTo.closeDate}
        <br/>
        <br/>
    </messaging:htmlEmailBody>
    <messaging:plainTextEmailBody >
        close Date: {!relatedTo.closeDate}
    </messaging:plainTextEmailBody >
</messaging:emailTemplate> 

Output

 close Date: Thu Aug 22 00:00:00 GMT 2013 
 close Date: Thu Aug 22 00:00:00 GMT 2013
0
2

Try This.

<messaging:emailTemplate subject="This is my subject" recipientType="User" relatedToType="Opportunity">
            <messaging:htmlEmailBody >
                close Date: <apex:outputText value="{0, date, MMMM d','  yyyy}">
                                 <apex:param value="{!relatedTo.closeDate}" /> 
                            </apex:outputText>
                <br/>
                <br/>
            </messaging:htmlEmailBody>
            <messaging:plainTextEmailBody >
                close Date: {!relatedTo.closeDate}
            </messaging:plainTextEmailBody >
        </messaging:emailTemplate> 

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