I need some help and i am a little confused.

I have the following field Delivery_Date__c which is the datatype of Date/Time. I know i can extract the date and time separately within my email body, but what i would like to do is extract the date from this field for the subject but really struggling to find a way to do this.

This is my current opening

<messaging:emailTemplate recipientType="Contact"
    subject="Schroders – Shipping to: 
        {!relatedTo.Delivery_City__c} – {!relatedTo.Delivery_Date__c}"
    replyTo="abc@test.com" >
    <messaging:htmlEmailBody >  
  • 1
    {!DATEVALUE(relatedTo.Delivery_Date__c)}- does this helps?
    – Raul
    Feb 13 '17 at 10:51
  • 1
    You Sit a legend :) I used datetime lol
    – Masond3
    Feb 13 '17 at 10:56
  • Adding it as an answer, to help others facing similar issue!
    – Raul
    Feb 13 '17 at 11:25

Visualforce has some OOTB Date and Time Functions, you can use any one of them as per your requirement.

For date, use:

DATEVALUE- Returns a date value for a date/time or text expression.

For date time, use:

DATETIMEVALUE- Returns a year, month, day and GMT time value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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