title: path bindable date play framework
body: <p>I am attempting to pass a date through a route in my play framework app, which I am quite new to. After many hours i am now trying t get a pathbindable to work with the code below however whenever I run it I always get bad request with the "invalid date format blah blah" How can i get this to successfully pass the date to the controller? Please help</p>
  
  <pre><code>package libs
  
  import java.util.Date
  import java.text.SimpleDateFormat
  import play.api.mvc.PathBindable
  import scala.util.{Either, Failure, Success, Try}
  
  object PathBinders {
  
    implicit def bindableDate(implicit stringBinder: PathBindable[String]) = new PathBindable[Date] {
  
      val sdf = new SimpleDateFormat("EEE MMM ddd hh:mm:ss zzz yyyy")
  
      override def bind(key: String, value: String): Either[String, Date] = {
        for {
          dateString &lt;- stringBinder.bind(key, value).right
          date &lt;- Try(sdf.parse(dateString)).toOption.toRight("Invalid date format blah blah.").right
        } yield date
      }
  
      override def unbind(key: String, date: Date): String = key + "=" + sdf.format(date)
  
    }
  
  }
  </code></pre>
  
  <p>The format of it I have tried multiple different methods but in my app the page before I am successfully displaying the date as Thu May 10 00:00:00 BST 2018. This is coming from an ebean model which is linked to a SQL database.</p>