4 Replies Latest reply: Mar 28, 2012 9:42 AM by Karthic Rajha RSS

    Converting Date Format in Groovy

    Karthic Rajha
      Hi

      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,
      KR