I have a DateField and the datefield renders as "yyyy-mm-dd" for example: 2012-01-05, I wish to retrieve the DateField value but I get "2012-00-05", January is apparently set to month number 0, how can I get the displayed value for the DateField?
Relevant bits of code:
invoiceDate = new DateField();
invoiceDate.setFieldLabel("Invoice Date");
::::::::::::::::::::::::::::::::::
if (null != invoiceLine.getValue()) {
searchData.setInvoiceLine(invoiceLine.getValue());
}
:::::::::::::::::::::::::::::::::::
DateTimeFormat fmt = DateTimeFormat.getFormat("yyyy-mm-dd");
:::::::::::::::::::::::::::::::::::
if (null != searchData.getInvoiceDate()) {
System.out.println(fmt.format(searchData.getInvoiceDate()));
}
::::::::::::::::::::::::::::::::::
without the format I get: Thu Jan 05 12:00:00 ICT 2012
with the format I get: 2012-00-05
Why does anyone represent the months of the year as 00-11?
Has anyone else encountered this? How do you solve it?