How to reformat date Token field as full date?
When I insert a token date field into an HTML email, the default format is yyyy-mm-dd.
Does anyone know how to reformat the date as a long date? Example: Sunday, October 19, 2003
I think I need to create a new Email Script Token in my Program, but I don't know how to write javascript.
Based on what I read here:
http://developers.marketo.com/documentation/velocity-script/script-examples/
I found some sample code (below).
I want to reformat this field: lead.WarrantyExpirationDate
Desired format (long date): Sunday, October 19, 2003
I think the long date field is: $date.full_date
I know that I need to navigate to: Marketo > My Program > My Tokens > New > Email Script
and create a script for My Token {{WarrantyExpirationDate2}}.
I found these examples:
Example - Formatting a Date
Script Examples » Marketo Developers
##create a date and parse it with a format
##parseDate takes two args, a date string and the format
#set($myDate = $convert.parseDate("08-07-2015", "MM-dd-yyyy"))
##format the date
##format takes two args, the format and a date object
#set($formattedDate = $date.format("yyyy-MM-dd", $myDate))
${formattedDate}
I found another example here, but I don't know how to modify it for the long/full date format with my field names and I don't know which of these examples will work.
#set($myDate = $convert.parseDate(${lead.eventdate}, "dd-MM-yyyy"))
#set($formattedDate = $date.format("yyyy-MM-dd", $myDate))
${formattedDate}
Thanks in advance for your help!