title: Comparing dates with Velocity scripting?
body: <p>I am currently using Marketo and we want to pull through some data by looking at the date when the custom object information was entered.</p>
  
  <p>I know php, javascript etc but Velocity is a new thing, although familiar I can't work out the best way to compare dates.</p>
  
  <p>In the code below I have tried two ways, using the Number Tool or Date Tool but have not had much luck.
      ##Get all the custom object data
      #set( $items = ${customerPurchaseData_cList} )</p>
  
  <pre><code>#set( $currentDateNumber = $number.toNumber('25/01/2016') )
  #set( $startDateNumber = $number.toNumber($item.orderDate) )
  
  $currentDateNumber
  $startDateNumber 
  
  #if( $startDateNumber &lt;= $currentDateNumber )
  
  ## if the date is current date is less than do something
  
  #end
  
  #set($cal1=$date.toCalendar('25/01/2016'))
  #set($strDate1=$date.format('MM/dd/yyyy hh:mm:ss a',$cal1))
  ##set($cal1 = $cal1.get('yyyy-M-d H:m:s')) 
  #set($calCompare=$item.orderDate.compareTo($strDate1))
  
  &lt;ul&gt;
  #foreach ( $item in $items )
  
  #if ($calCompare &gt; 0)
  
  &lt;li&gt;$item.MetalType&lt;/l1&gt;
  
  #end ##end of if statement
  
  #end ##end of foreach
  &lt;/ul&gt;
  
  ## &gt; $date.get('2017-01-01')
  ### if ($item.orderDate &gt; $date.get('2017-01-01'))
  </code></pre>
  
  <p>Is there an easy way to compare the date values? Such as turning them into UNIX Timestamps?</p>
  
  <p>Your help would be amazing!</p>