removing time stamp from a date field

Anonymous
Not applicable

removing time stamp from a date field

Hi All,

I'm trying to use a trial end date token in a email, but the date is formatted as MM-DD-YY 00:00:00. Is there a way I can remove the time stamp? we are syncing this data over from our application database so it would not be easy to change it at the source.

Tags (2)
4 REPLIES 4
Anonymous
Not applicable

Re: removing time stamp from a date field

Hi Joshua,

This would be a great candidate for using velocity script in an email script token. I haven't come across this use case myself in the past, but there is some great documentation out there on converting date formats. Here's one in relation to localized date formatting from Jenna Molby​: How to Localize a Date Field in Marketo

It's not your exact use case, but it's a good start.

Hope that helps,

Tim

SanfordWhiteman
Level 10 - Community Moderator

Re: removing time stamp from a date field

Velocity script:

#set( $myRealDate = $convert.parseDate($lead.myDateyStringField.,'MM-dd-yy HH:mm:ss') )

${date.format('MM-dd-yy',myRealDate)}

Anonymous
Not applicable

Re: removing time stamp from a date field

Hi Sanford,

quick follow up question. Do I put this into the program token list and then use this as the token or still use the original date token?

FYI I'm using the email script token to create this.

SanfordWhiteman
Level 10 - Community Moderator

Re: removing time stamp from a date field

Add this as a new {{my.token}} and use the new token name in the email.