24 Replies Latest reply on Feb 13, 2018 10:03 PM by Sanford Whiteman

    Issue with Time Display in Email Velocity Script

    David Chase

      Launched Marketo in Nov-16 and during implementation a couple of MyTokens were set-up using Velocity script to convert dates and times, to our local timezone Australia/Sydney:


      • {{my.Appt Date}}   - for the clients appointment date with consultant
      • {{my.Appt Date Time}}    - for appointment time with consultant (the actual field it references also includes the date)


      The date token is working fine, but the time token is displaying 7 hours later than it should be, (e.g. 5pm instead of 10am). The date and time are pulled from separate Fields in the database.


      This is the script that's being used:


      #set( $inTimeZone = $date.getTimeZone().getTimeZone('Australia/Sydney') )

      #set( $outTimeZone = $date.getTimeZone().getTimeZone('Australia/Sydney') )

      #set( $locale = $date.getLocale() )

      #set( $myDate = $convert.parseDate(${lead.apptBookedTime},'yy-MM-dd HH:mm',$locale,$inTimeZone) )

      ${date.format('hh:mm a',$myDate,$locale,$outTimeZone)}


      I don't have much experience with Velocity, did a bit of reading online, but can't work out why the above would be showing the time incorrectly.


      Can anyone help me solve? Thanks in advance!