How to choose Hours instead of Date
I was wondering how to choose hours instead of a date [month,year,day].
I'm using this piece of code:
entity - class ~. domain.Availab开发者_开发百科ility --testAutomatically --identifierField
date field --fieldName begin - notnull --type java.util.Date --past
field date --end fieldName - notnull --type java.util.Date --past
field reference --fieldName teacher --type ~. domain.Teacher --notnull
Running this code in your browser, a calendar appears to choose the year, month and day. I just want to pick a certain time of day. For example Begin: 08:00 hours End: 12:00 hours
Cheers,
Try --dateTimeFormatPattern="hh:mm"
Source: http://static.springsource.org/spring-roo/reference/html/command-index.html#command-index-field-date
According to the javadoc for @DateTimeFormat
For style-based formatting, set the style()
attribute to be the style pattern code.
The first character of the code is the date style, and the second character is the time style. Specify a character of 'S'
for short style, 'M'
for medium, 'L'
for long, and 'F'
for full. A date or time may be omitted by specifying the style character '-'
.
@DateTimeFormat(style = "-F")
You can try do this.
focus --class ~.domain.YourEntity
field date --fieldName yourfield --type java.util.Date --dateTimeFormatPattern "hh:mm"
This form is better , from archive .java , alone write it.
/**
*/
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(style = "-S")
private Date yourhours;
精彩评论