Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Date format in DataSource XML File

    Hi,

    is there a way how to set the date format in the Datasource XML File ?

    <field name="creationDate" type="date">

    #2
    Yup, DataSourceField.displayFormat.

    Comment


      #3
      ok, thank you.

      Comment


        #4
        on the javadocs there are no sample for formatting.

        I also have a question regarding default falue

        for last updated records I have a date field lastUpdatedAt as date, I'd like to define it as now()

        can it be done?

        Comment


          #5
          Originally posted by joppert
          on the javadocs there are no sample for formatting.

          I also have a question regarding default falue

          for last updated records I have a date field lastUpdatedAt as date, I'd like to define it as now()

          can it be done?
          I was able to define this in the java code using:

          TextItem dateOfBirth = new TextItem( "dob" );
          dateOfBirth.setDateFormatter( DateDisplayFormat.TOEUROPEANSHORTDATE );

          I don't know so far how to specify this in the ds.xml file

          Cheers,

          EJ

          Comment


            #6
            Again, use DataSourceField.displayFormat to set the formatter centrally.

            For a default value of "now", don't try to do this in the .ds.xml, do it in client Java code. If you think about it, you potentially need the value to be timezone sensitive, as well to be change if the user keeps the application open overnight.

            Comment


              #7
              Originally posted by Isomorphic
              Again, use DataSourceField.displayFormat to set the formatter centrally.

              For a default value of "now", don't try to do this in the .ds.xml, do it in client Java code. If you think about it, you potentially need the value to be timezone sensitive, as well to be change if the user keeps the application open overnight.
              Code:
              I was thinging of having a <field type="date" formatString="EUROPEAN"...
              Can this be done?

              Cheers,

              EJ

              Comment


                #8
                Hi,

                Doing so

                Code:
                <field name="dob" type="date" title="Date of Birth" displayFormat="DateDisplauFormat.TOEUROPEANSHORTDATE"/>
                AND
                Code:
                <field name="dob" type="date" title="Date of Birth" displayFormat="TOEUROPEANSHORTDATE"/>
                Won't work

                Cheers,

                EJ

                Comment


                  #9
                  Use "toEuropeanShortDate" and in general, use camelCaps String values for any of the other settings as well. We'll clear this up in the docs.

                  Comment


                    #10
                    Hi,

                    It works!

                    Properly setting as

                    Code:
                    <field name="dob" type="date" title="Date of Birth" dateFormatter="toEuropeanShortDate"/>
                    param is dateFormatter

                    Much appreciated

                    Cheers,

                    EJ

                    Comment

                    Working...
                    X