print date format in Velocity Spring MVC
I'm trying to create registration form using Spring MVC and Velocity as view. in the view there are inputs: userna开发者_运维知识库me email password confirmpassword birthday -> format MM/dd/yyyy
when user submit the form, my controller validate the form input/command. if there some error, it will show back to the view and print the birth day in correct format.
but the date printed as not formated date. I try use $dateTool.format('MM/dd/yyyy', $registration.BirthDay) but the birthday value still not formated.
any helps needed.
Thanks
Just incase you are missing the link to make it work - http://javacompleteexamples.blogspot.in/2009/07/velocity-example-with-for-loop-and-date.html Note the important line - ctx.put("date", new DateTool()); replace date with dateTool or anything that you want to use in vm for formatting utility.
Probably too late, but since I bumped on it on Google, posting it in case someone else needs it:
try: $date.format('MM/dd/yyyy',$registration.BirthDay)
精彩评论