Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <messaging:emailTemplate recipientType="User"
- relatedToType="Opportunity"
- subject="for Opportunity: {!relatedTo.name}">
- <messaging:htmlEmailBody >
- <html>
- <body>
- <font face="arial" size="2">
- <p>Dear {!recipient.name},</p>
- <p>
- <apex:outputtext value="{!day(DATEVALUE(relatedTo.LastModifiedDate))}/"/>
- <apex:outputtext value="{!case(month(DATEVALUE(relatedTo.LastModifiedDate)),5, "May", 6, "June",7, "Juillet","None")}" rendered="{!recipient.LanguageLocaleKey=='nl_NL'}"/>
- <apex:outputtext value="{!case(month(DATEVALUE(relatedTo.LastModifiedDate)),1,"January",2,"February",3,"March",4,"April",5, "May",6,"June",7,"Juli",8,"August",9,"September",10,"October",11,"November",12,"December","None")}" rendered="{!recipient.LanguageLocaleKey=='fr'}"/>
- <apex:outputtext value="/{!year(DATEVALUE(relatedTo.LastModifiedDate))}"/>
- </p>
- </font>
- </body>
- </html>
- </messaging:htmlEmailBody>
- </messaging:emailTemplate>
- Dear Alice,
- 4/Juli/2016
- public class controller_formatted_datetime
- {
- public DateTime date_time { get; set; } //property that reads the datetime value from component attribute tag
- public String defined_format { get; set;} //property that reads the string value from component attribute tag
- public String getFormattedDatetime()
- {
- if (date_time == null) {return ''; }
- else { if (defined_format == null) {
- return date_time.format(); //return the full date/time in user's locale and time zone
- }
- else { return date_time.format(defined_format,'PST'); //Specify Time zone like IST,CST
- }}}}
- <apex:component access="global" controller="controller_formatted_datetime">{!FormattedDatetime}
- <apex:attribute assignTo="{!date_time}" description="The DateTime value to be rendered" name="date_time_value" type="DateTime"></apex:attribute>
- <apex:attribute assignTo="{!defined_format}" description="The optional format to use for the DateTime value to be rendered" name="date_time_format" type="String"></apex:attribute>
- </apex:component>
- <messaging:emailTemplate subject="Testing DateTime Format" recipientType="Contact" >
- <messaging:plainTextEmailBody >
- Formatted: <c:VFEmailTempComp date_time_value="{!NOW()}" date_time_format="EEE MMM d kk:mm:ss z yyyy" />
- </messaging:plainTextEmailBody>
- </messaging:emailTemplate>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement