1. #1
    Sencha User
    Join Date
    Sep 2007
    Posts
    59
    Vote Rating
    0
    jamone is on a distinguished road

      0  

    Default Answered: DateTimeFormat issue

    Answered: DateTimeFormat issue


    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?

    Thanks in advance.
    Cheers.

  2. Have you looked at the javadoc for the class you are using (which is not even related to GXT)?

    http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/i18n/client/DateTimeFormat.html


    m is relevant for the minutes, you are looking for M

  3. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    Answers
    60
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Have you looked at the javadoc for the class you are using (which is not even related to GXT)?

    http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/i18n/client/DateTimeFormat.html


    m is relevant for the minutes, you are looking for M

  4. #3
    Sencha User
    Join Date
    Sep 2007
    Posts
    59
    Vote Rating
    0
    jamone is on a distinguished road

      0  

    Default Thanks

    Thanks


    I spotted that 5 minutes after I sent this thread. Sorry coding at 3AM.

    Cheers.

Thread Participants: 1