Results 1 to 3 of 3

Thread: DateTimeFormat issue

  1. #1
    Sencha User
    Join Date
    Sep 2007
    Posts
    59
    Vote Rating
    0
      0  

    Default 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 Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Answers
    60
    Vote Rating
    131
      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
      0  

    Default Thanks

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

    Cheers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •