Working on an Email Script Token, and it is not returning the expected value.
As best as I can tell from looking at examples this should return -3, but it is returning $date.whenIs($myDats).days instead.
The field in the custom object is defined as date
Current Date I am writing this : 2015-11-12
#foreach($loan_c in $loan_cList)
#set($myDays = ${loan_c.sAPStatusDate})
<tr>
<td>${loan_c.sAPStatusDate}</td>
<td>$date.whenIs($myDays).days</td>
</tr>
#end
Output:
2015-11-09 $date.whenIs($myDays).days
Anyone have any idea why it is not displaying -3?
No matter what I tried, I had to use convert.parseDate to convert dates into a 'real' date for use with whenIs.
#set($myVar = $convert.parseDate(${myVar},'yyyy-MM-dd'))
$date.whenIs($myVar).days
Yep, dates are exported to Velocity as strings, so this is expected. You're doing the right/only thing.
See also my comments here: https://nation.marketo.com/blogs/marketowhisperer/2016/08/14/velocity-script-tokens-as-an-alternativ...
(Unfortunately posting from my second account but it's the same Sanford.)
Hey Dave Lyon check this out: http://blog.teknkl.com/marketo-vtl-strings-all-the-way-down/ . Like to see your comments/findings in this area.
Looking forward to your velocity posts. Valuable info.