Convert Unix timestamp to Java Date, Spring RequestParam

Since timestamps aren’t a formatted date (going by Java’s SimpleDateFormat options), but more a numeric value: I would recommend making a custom data-binder for Date objects if you’re doing this more often than this single instance. See http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#portlet-ann-webdatabinder

As a one-off solution you can bind them to Long parameters and create your own Date object with new Date(start).

Leave a Comment