AnsweredAssumed Answered

Printing dates on Velocity

Question asked by 4bf25a2f97881ec56037c8ed57714b4e6ff1d9aa on Jul 26, 2018
Latest reply on Jul 27, 2018 by 4bf25a2f97881ec56037c8ed57714b4e6ff1d9aa


I'm currently trying through a script token, calculate the difference in days, between two dates and display them on an email. The problem that I have is that when trying to print the result i'm just getting the variable name.


Here's my script token code:


#set($test = ${lead.DateofBirth})

#set($test2 = $test.length())

#set($leadAcquisition = ${lead.Acquisition_Date})

#set($acquistionString = $leadAcquisition.substring(0,10))

#set($dateDifference = $date.difference('2018-05-05', '2018-04-04').toString())


Here's my the section of the Email where I'm trying to print the values:


         TEST $test TEST2 $test2 LeadAcquisition $leadAcquisition AcquisitionString $acquistionString DateDifference $dateDifference



But this is my output:


TEST 1986-08-16 TEST2 10 LeadAcquisition 2018-07-23 17:35:00 AcquisitionString 2018-07-23 DateDifference $dateDifference


I have tried printiing other values accesible from the DateTool and DateComparison tool with no success. So I'm thinking that maybe I'm not calling the methods correctly because others seem to work.


Anyone have a clue of what could be the problem and a possible solution?


Thanks in advance.