AnsweredAssumed Answered

How to reformat date Token field as full date?

Question asked by 10a7e71efc9a524831b5194a355a5b9a441ce620 on Sep 6, 2016
Latest reply on Sep 22, 2016 by 10a7e71efc9a524831b5194a355a5b9a441ce620

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:

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))



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))


Thanks in advance for your help!