Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playframework 2.X and Date format within scala template

How do you display a Date object to your desired pattern in a Playframework 2.X template ?

public class Job {
  public Date date
}

When i display @job.date in the scala template, i have the following displayed:

Tue Nov 19 12:49:46 WST 2013 

Expected is:

19 Nov

Important : date object is set using new Date(). I don't want to change the pattern when setting the date object, i only want to display my date with the pattern of my choice in the view. Is it possible ?

Many thanks

like image 883
Florent Valdelievre Avatar asked Nov 19 '13 05:11

Florent Valdelievre


1 Answers

In scala template:

@job.date.format("dd MMM")
like image 142
Leo Avatar answered Oct 19 '22 11:10

Leo