DateField UI value different from server side getValue

Hi,

I just started using Vaadin and I have a simple question about DateField. I have a form with a DateField on it, and I have specified the format with
setDateFormat in my FieldFactory as below :

if (Date.class.isAssignableFrom(type))
{
final DateField df = new DateField();
df.setDateFormat(“yyyy/MM/dd”);
df.setResolution(DateField.RESOLUTION_DAY);
return df;
}

returned Field (df) above is assigned to currentField
I then try to bind to a Date property.
Date theDate = null;
property = new ObjectProperty(theDate, Date.class);
myForm.addField(property, currentField);

So in the end the formatting works correctly on the UI, I get something like 2012/07/18 in the UI,
however when I then to do a get value on that field from the server side (form.getField(itemPropertyId).getValue().toString():wink: the value is different, it’s the same
date, however the format is something like " Wed Jul 18 22:29:34 EDT 2012" ?? I want this value to be returned with the same format as specified (2012/07/18)

What am I missing here?

Thanks for the help in advance

You are not getting a String but a Date on the Server-side. You can format it in whatever way you like, calculate something with it and do all other dirty things you would normally do with a Date.

Thanks Tobias, that makes sense, since I guess I just got myself all wound up over the formatting !