How can I set current year to be a token?

Highlighted
Anonymous
Not applicable

How can I set current year to be a token?

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)
5 REPLIES 5
Highlighted
Anonymous
Not applicable

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

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. 
Highlighted

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

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. 
Highlighted
Level 1

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

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

Highlighted
Level 10 - Community Moderator

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

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

Highlighted
Level 1

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

Marketo now supports the token {{system.dateYear}} to populate current year. It is case sensitive. Other similar tokens like {{system.dateMonth}} and {{system.dateDay}} are not supported.

Marketo Certified Expert