8 Replies Latest reply on Dec 4, 2017 8:39 AM by Liz Davalos

    Beginner velocity scripting

    Liz Davalos

      I'm trying to make a script for email that sets the expiration date for an offer 7 days from the send date. Here's what I have, but I can't seem to piece it together.

       

      ## Get a java Calendar

      #set($x = $date.calendar)

       

      ## Add 24 hours (hours=int code 10 - see list below)

      $x.add(10,168)

       

      #set( $inTimeZone = $date.getTimeZone().getTimeZone('America/Los_Angeles') ) 

      #set( $outTimeZone = $date.getTimeZone().getTimeZone('America/Los_Angeles') ) 

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

      #set( $myDate = $convert.parseDate($x.time,'MM-dd-yy HH:mm:ss',$locale,$inTimeZone) ) 

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

       

      Ideally I'd like to format the output date to MMM dd, yyyy hh:ss PST.