Announcement

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

    Anyway to turn off ALL SmartGWT timezone Conversion?

    I'm using some SmartGWT controls and some from another toolkit that handles date/time. And so in my app I let the user select which timezone they want their information to appear in.

    So is there a way to turn off ALL automatic timezone conversion in the SmartGWT controls?

    thanks.

    Chris

    #2
    DateUtil.setDefaultDisplayTimezone();

    Comment


      #3
      Yes but what would I set it to? "00:00"? Would I then have to determine what timezone my user has selected and then set the offset?

      Comment


        #4
        Well if you set it to 00:00 and pass it a date then it will display that date. If you set it to something else and pass it a date object it will add or subtract from it. So it won't modify any dates passed from your other code if you set it to 00:00.

        Comment


          #5
          Hello,

          I am doing the same thing with adding DateUtil.setDefaultDisplayTimezone("+00:00") on my module load... but seems to be its not working in my Listgrid aswell as DateItem too... its converting the server time to my local time according to respective timezone

          Eg: Server time is 15th Dec 2010 10:14:40 AM then
          Client time is being converting to 15th Dec 2010 03:44:40 PM

          SmartGWT Version : 2.3

          Sample Code :

          ListGridField createdDt = new ListGridField("createdDt","Created Date", 70);

          Datasource code:

          DataSourceDateField createdDt = new DataSourceDateField("createdDt");

          On immediate OnModule load, i am calling DateUtil.setDefaultDisplayTimezone("+00:00").

          FYI... i even tried out DateUtil.setDefaultDisplayTimezone("00:00") by removing +/- sign.


          Can anyone help me out...

          Thanks,
          Bala

          Comment


            #6
            Hello,

            I have created a sample testcase was available at below location (TimeZoneTest.zip)
            http://www.4shared.com/dir/degGaBBV/SmartClient.html

            Can anyone tell me how to disable automatic conversion of timezones from Server to client

            Thanks,
            Bala

            Comment


              #7
              Hello,

              Can anyone tell me how to fix this issue.

              Thanks,
              Bala

              Comment


                #8
                Hi,

                The above mentioned issue was fixed with using below code

                Code:
                dateFormatter.format(date, TimeZone.createTimeZone(0))
                instead of

                Code:
                dateFormatter.format(date)
                Regards,
                Bala

                Comment


                  #9
                  Hello Bala.

                  I have the same problem.

                  My client program is showing the Date converted to the local browser timezone.

                  Can you please give more detail of the solution you have?

                  Is that code: dateFormatter.format(date, TimeZone.createTimeZone(0))
                  in the server side or in the client side?

                  What DateFormat class did you use to solve that?

                  Thanks in advance.

                  Comment


                    #10
                    Hi,

                    I have the same issue around timezone problems.

                    It looks like when you adddata or updatedata with dateitem datasourcefield on the record via a datasource, the record stored in database is not in GMT. Instead its stored with the browser local timezone.

                    Is it possible to store the record with the datetime in GMT and then display this field in the ui with the local timezone of the user browser?

                    Hope Isomorphic could help us.

                    Thanks in advance,

                    Pablo

                    Comment


                      #11
                      The default handling is to transmit a datetime to the server as a GMT time so there doesn't seem to be a way this could happen. If you disagree, please show a test case.

                      Comment


                        #12
                        Hi Isomorphic,

                        I am trying to understand how SmartGwt works with dates.

                        My intention is to store Datetimes in sql database in UTC Timezone and then then get it from database in UTC and show it in the browser with the browsers timezone.

                        I have developed a simple testcase where It shows that the Datasource.adddata operation stores the date in the browser timezone not in GMT. That is problem users can have different timezones and it will show incorrect dates.

                        In the testcase you have:

                        testcase.java: the main class where I show the dates stored in the SQL database and you can create new dates

                        testcase.ds.xml: it represents the datasource definition

                        testcase.sql: the SQL script with the data stored in the database and the table definition

                        screenshot.jpg: an image where show the dates in the UI with the correct timezone but it shouldnt be the same as the date stored in the sql database.

                        Hope you could help me find how to get it working.

                        Thanks in advanced,

                        Pablo
                        Attached Files

                        Comment


                          #13
                          Hi isomorphic,

                          Another thing maybe could help us.

                          I have changed my client desktop timezone settings, but the storage in the database is still getting the old timezone so I think maybe is not the desktop/browser.

                          I have look into the Mysql database settings and I have changed the default time zone to +00:00 but doesnt work.

                          Hope you could find the clue!!

                          Thanks,

                          Pablo

                          Comment


                            #14
                            What is it that you think this testcase demonstrates? It doesn't demonstrate a bug.

                            You should look through the Date and Time handling overview and the docs for setting the default display timezone. Then if you think you've found a bug, please explain exactly what you think it wrong in terms of expected values in the browser, on the network, and in the DB.

                            Alternatively if you just have a question about how to do something, explain exactly what you want in terms of expected values.

                            Comment


                              #15
                              Hi isomorphic,

                              As you said in your previous post, the date time fields are sent in GMT to server but in the test case i try to show you that the data stored in the database is not in Gmt. The datasource add data operation stores the date in database with local zone and it should store it in gmt, shouldnt it??

                              The display format settings affect the timezone sent to server?

                              What i need is to store the datetime field in database with gmt timezone when i call the adddata operation. and then get the date from database with fetch operation and show it in listgrid with local timezone.

                              Jope you could undestand what i am expecting and could help me find the way to do it.

                              Thanks in advance,

                              Pablo

                              Comment

                              Working...
                              X