Re: How can I set current year to be a token?

Anonymous
Not applicable
Am I missing this or can you not have a field "current date" and use it as a token for email and landing page snippets? Not the system date, but "2015" for example to use for copyright info.
Tags (1)
4 REPLIES 4
Joe_Fusaro
Level 2

Hi Eric, I know this post is a few years old but here's what worked for me:

Create an email script token in Active Marketo Tokens. I called it "Current Year"

Screen Shot 2019-01-03 at 9.35.21 AM.png

Open the email script editor ("Click to edit") and enter the following:

$date.get('yyyy')

That should dynamically populate the current year using Velocity

SanfordWhiteman
Level 10 - Community Moderator

Don't forget the timezone though:

$date.format(

  "yyyy",

  $date,

  $date.getLocale(),

  $date.getTimeZone().getTimeZone("Australia/Canberra")

)

Only matters for one day out of the year, but that may be the day somebody decides to QA it...

Jep_Castelein2
Level 10
You can also look at using Email Scripting: http://developers.marketo.com/documentation/email-scripting/. It's a little bit more technical, but it would allow you to always have the correct year and not have to manually edit it. 
Anonymous
Not applicable
Hey Eric, you can create tokens in parent folders and they will cascade down into all of the child folders underneath. That might be the easiest method to use year as a token.