Hi, I need to change the standard date format from: 2017-02-27 to 27 February 2017 for an email send to a list of leads with a specific date for each.
I'm using a token for a Contract Date field: {{lead.Contract Date}} which produces the standard format 2017-02-27
The date in the lead record for the Contact Date field begins like this: Feb 27, 2017
Reading throughout the community on how to fix this and it's not as clear as I'd like but nonetheless I'm reaching out to see if there's a clear-cut answer as to how to code the velocity script and step by step instructions so it works. I understand I can use a My.token at the program level and code it in velocity script, but from there I need more guidance. Thanks! -T
Solved! Go to Solution.
What time zone are those dates in (yes, this is an important detail when converting)?
Central Standard Time
Hi Trinity,
You will find a lot of useful info:
http://blog.teknkl.com/marketo-vtl-strings-all-the-way-down/
How to reformat date Token field as full date?
-Greg
Checking out these links, Yes the time zone is important as I'm reading what Sanford said and going to attempt to fix this myself based off the similar conversation another lady had, but my client is asking that I spell out the month...that seems a bit more involved, is there additional code to render each unique month into it's corresponding word? Many Thanks!!!
Date format macro for the full month is MMMM. Thus when outputting the date/calendar object $contractDate:
${date.format("d MMMM yyyy",$contractDate)}
Ok thank you I just tried the other way from the third link that Greg provided and it worked!!
Monday, February 27, 2017
I'm going to try this new code you just provided but I think my internal client will accept either option, thanks to you both, always appreciated how helpful and quick you are!!!
Sanford Whiteman I tried replacing the last line of code with this:
${date.format("d MMMM yyyy",$contractDate)}
But it rendered incorrect: ${date.format("d MMMM yyyy",$contractDate)} , and I'm too curious not to understand my mistake, what did I do wrong?
Probably because you aren't using the variable name $contractDate. You'd replace that with the actual variable name declared earlier in your code.
Hmm sorry Sanford not sure about that, I'm still learning and I tried something and it didn't work, thus I keep trying