Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. <messaging:emailTemplate recipientType="User"
  2. relatedToType="Opportunity"
  3. subject="for Opportunity: {!relatedTo.name}">
  4. <messaging:htmlEmailBody >
  5. <html>
  6. <body>
  7. <font face="arial" size="2">
  8. <p>Dear {!recipient.name},</p>
  9. <p>
  10. <apex:outputtext value="{!day(DATEVALUE(relatedTo.LastModifiedDate))}/"/>
  11. <apex:outputtext value="{!case(month(DATEVALUE(relatedTo.LastModifiedDate)),5, "May", 6, "June",7, "Juillet","None")}" rendered="{!recipient.LanguageLocaleKey=='nl_NL'}"/>
  12.  
  13. <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'}"/>
  14. <apex:outputtext value="/{!year(DATEVALUE(relatedTo.LastModifiedDate))}"/>
  15. </p>
  16. </font>
  17. </body>
  18. </html>
  19. </messaging:htmlEmailBody>
  20.  
  21. </messaging:emailTemplate>
  22.  
  23. Dear Alice,
  24.  
  25. 4/Juli/2016
  26.  
  27. public class controller_formatted_datetime
  28. {
  29. public DateTime date_time { get; set; } //property that reads the datetime value from component attribute tag
  30. public String defined_format { get; set;} //property that reads the string value from component attribute tag
  31. public String getFormattedDatetime()
  32. {
  33. if (date_time == null) {return ''; }
  34. else { if (defined_format == null) {
  35. return date_time.format(); //return the full date/time in user's locale and time zone
  36. }
  37. else { return date_time.format(defined_format,'PST'); //Specify Time zone like IST,CST
  38. }}}}
  39.  
  40. <apex:component access="global" controller="controller_formatted_datetime">{!FormattedDatetime}
  41. <apex:attribute assignTo="{!date_time}" description="The DateTime value to be rendered" name="date_time_value" type="DateTime"></apex:attribute>
  42. <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>
  43. </apex:component>
  44.  
  45. <messaging:emailTemplate subject="Testing DateTime Format" recipientType="Contact" >
  46. <messaging:plainTextEmailBody >
  47. Formatted: <c:VFEmailTempComp date_time_value="{!NOW()}" date_time_format="EEE MMM d kk:mm:ss z yyyy" />
  48. </messaging:plainTextEmailBody>
  49. </messaging:emailTemplate>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement