I have an existing lead field that contains the value for a specific month, presented as YYYY-MM.
From this, I want to set up a script token that only returns the value for the month, irrespective of which year is indicated. I have the section of script to translate the MM value into "January", but I am struggling to strip the year indicator from the original value.
I looked into substring and truncate options, but have not found a working solution.
Does anyone have a suggestion?
Solved! Go to Solution.
#set( $dateObj = $convert.parseDate( $lead.yourField, "yyyy-MM" ) )
${date.format("MMMM", $dateObj, $convert.toLocale("nl_NL"))}
I just knew there had to be a @SanfordWhiteman post out there somewhere that would help, and indeed!
Got there most of the way with the solution in this post: https://nation.marketo.com/t5/Product-Discussions/How-do-I-modify-the-date-format-for-a-token-using-...
Now just looking for a way to represent the MMMM in nl_NL locale so it shows the Dutch version of "January".
Wow, I was overcomplicating again. Clean and effective.
Thank you!