I used your code to create My Token in the Program:
$date.format("MM/dd/yyyy", $convert.parseDate(${lead.WarrantyExpirationDate}, "yyyy-MM-dd"))
I applied this in the html body:
{{my.WarrantyExpirationDateFormatted}}
The email displayed the code literally.
What's missing?
I understand the script token needs to be inserted in lieu of the date token, but I'm getting an error using my date token in the code provided above:
I defined a date toke: {my.event date}
But $date.format("MM/dd/yyyy", $convert.parseDate(${my.event date}, "yyyy-MM-dd")) causes an error when sending the email.
Did you find an answer to using {my.event date}? We are also having a problem using the date token.
Really sorry I'm only seeing this comment now. I hope you since figured it out.
In your code you are placing the my token in,
$date.format("MM/dd/yyyy", $convert.parseDate(${my.event date}, "yyyy-MM-dd"))
you should be placing the name of your lead field in here not the name of the token.
Courtney O'Donnell It won't work with my/program token values only database field values.
I think an easier solution for you would be to use a text program token instead of a date program token. That way you can write the format whatever way that you want.
I don't think you can nest operations like you're trying to do in the code snippet you provided. I was able to accomplish this by setting a variable and using it as an input to the outer operation:
#set($str = $convert.parseDate(${lead.HEye_Trigger_Expire__c}, "yyyy-MM-dd"))
$date.format("MM/dd/yyyy",$str)
Here's where I got the idea:
http://stackoverflow.com/questions/22150952/string-to-date-with-convert