I have a bean which contains a field of type java.lang.String
. This field holds free-form text which can represent a number, string, or date. When the field represents a date, I render a calendar (primefaces) on the screen, otherwise an input box is rendered.
The problem I'm having is that after the user selects the date via the calendar, I would like the date string that gets written to my free-form field to have a specific format (MM/dd/yyyy). Currently the string that gets set has the default format you get when you do a toString()
on a java.util.Date
object.
Does anyone know how I can control the format of the string that gets written to my field?
Thanks.