DateField value

I have a problem getting the value com.gwtext.client.widgets.form.DateField

. I would like to parse a date on the server side, so I use the method getText()

instead getValue()

. The problem is that the component DateField

is in YYYY-MM-DD format, but if I print the date value, I get the result "Thu Sep 17 2009 00:00:00 GMT + 0200", so the format is different. I thought the result getValueAsString()

would be like "Thu Sep 17 2009 00:00:00 GMT + 0200", but getText()

should return "2009-09-17" :( but it is not. Can I get the value in the correct format ?

+2


source to share


2 answers


You can use formatters, they are part of the GWT platform

 DateField date = new DateField();
 String result = DateTimeFormat.getFormat("MM/dd/yyyy").format(date.getValue());

      



Hope it works.

+1


source


use getRawValue()



-1


source







All Articles