2 Replies Latest reply on Jul 27, 2018 12:02 PM by Pablo Wolff

    Printing dates on Velocity

    Pablo Wolff

      Hi,

      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:

      <div>

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

      </div>

       

      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.