Quote:
Originally Posted by ahsan_cse2004
I did it as follows
Code:
<spring-tags:bind path="startDate">
<input type="text" value="<fmt:formatDate value="${startDate}" type="date" pattern="yyyy-MM-dd"/>" id="impressionReportStartDate" name="startDate"/>
</spring-tags:bind>
Where startDate is coming from my server code. Somehow I had to use name="startDate" also because path="startDate" alone did not work for me.
Thanks
Ahsan
|
Hi All,
I am also getting same type of probelm.
I am using date format is MM/dd/yyyy HH:mm
In my controller CustomDateEditorcode is like given below
@InitBinder protected void initBinder(final WebDataBinder dataBinder) {
final SimpleDateFormat dateFormat = new SimpleDateFormat(
"MM/dd/yyyy HH:mm");
dataBinder.registerCustomEditor(Date.class,
new CustomDateEditor(dateFormat, true));
}
and in my velocity file the code is lke this:
<input type="text" id="start" name="start" value="$!date.format('MM/dd/yyyy H:m',$!campaign.start)" size="30" class='field text small #if($status.error) error #end' tabindex="4" />
If user entered date as : 19/02/2012 11:53 , then it is not ging any error or exception simply accepting and taken as Tue Jul 02 11:53:00 IST 2013.
Can anybody tell me the way how to strict the month value to maximum 12.
Thanks,
Syamala.