You need to sign in to do that
Don't have an account?
Raj R.
How to display date as mm/dd/yyyy when sending an email through apex class?
Hi,
I am trying to send an email where I include certain values from a customObj1. I noticed that when I insert the field "Start_Date__c" (type is Date) into the email body, then the field renders as "2015-08-12 00:00:00". This is not what I want.
How can I include a Date field that will output as "MM/DD/YYYY" (or MM-DD-YYY) in an email that is sent from an apex classes?
I am trying to send an email where I include certain values from a customObj1. I noticed that when I insert the field "Start_Date__c" (type is Date) into the email body, then the field renders as "2015-08-12 00:00:00". This is not what I want.
How can I include a Date field that will output as "MM/DD/YYYY" (or MM-DD-YYY) in an email that is sent from an apex classes?
Hi rRup,
If you only want to format your date in your current user's locale then you can use below code.
OR if you want to keep a fixed date format as "MM/DD/YYYY" then use as
In the previos comment you were not getting expected result because 'mm' is for Minutes. So we must use 'MM' for month.
All Answers
use the below code just in place of myDT use your field.
Please select it as best answer if it solves your problem !!!!!!!!!
That does not work. Below is what i did and the results. Any other thoughts?
Hi rRup,
If you only want to format your date in your current user's locale then you can use below code.
OR if you want to keep a fixed date format as "MM/DD/YYYY" then use as
In the previos comment you were not getting expected result because 'mm' is for Minutes. So we must use 'MM' for month.