title: String to date groovy
body: <p>How to convert String to Date ?</p>
  
  <p>I tried this:</p>
  
  <pre><code>@RequestMapping("/data/{data}")
      String buscar(@PathVariable String data, Model model) {
  
      model.addAttribute 'dataBuscar', data
  
  
      def newDate = data
      def df1 = new SimpleDateFormat("dd/MM/yyyy 00:00:00")
      data = df1.parse(newDate)
  
      model.addAttribute 'acessos', acessoService.buscar(data)
  
      'acesso/acesso.index'
  }
  </code></pre>
  
  <p>but show me this message:</p>
  
  <pre><code>Unparseable date: "12-01-2014"
  
  java.text.DateFormat.parse(DateFormat.java:337)
  java_text_DateFormat$parse.call(Unknown Source)
  org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
  org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
  org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
  br.com.owse.labs.owsetime.controllers.AcessoController.buscar(AcessoController.groovy:63)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
  org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
  org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
  com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
  br.com.owse.delorean.web.filters.SitemeshSpringFilter.super$2$doFilter(SitemeshSpringFilter.groovy)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
  org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
  groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
  groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
  org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
  br.com.owse.delorean.web.filters.SitemeshSpringFilter.doFilter(SitemeshSpringFilter.groovy:37)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
  org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
  java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>I need to parse this "12/01/2014 00:00:00"!</p>
  
  <p>Why? Any idea ?</p>