4 Replies Latest reply on Mar 28, 2012 2:42 PM by Karthic Rajha

    Converting Date Format in Groovy

    Karthic Rajha

      I have two fields (TravelDate and DepartureDate)
      TravelDate data type - TimeStamp (yyyy-mm-dd hh:mm:ss)
      Departure data type - TimeStamp (dd/mm/yyyy)

      We have a requirement of comparing TravelDate and DepartureDate.
      We are trying to compare the dates using groovy. Since groovy we are unable to pass to_date(substr ('2012-03-27 12:00:00',1,10),'dd/MM/yyyy') . It doesn't convert and instead it says substr name not found

      Can anyone help to convert yyyy-mm-dd hh:mm:ss   to    dd/mm/yyyy in groovy ?

      Thanks in Advance,