3 Replies Latest reply on Aug 29, 2008 12:09 PM by Garyl Woolworth

    Convert displayed datetime in Flex app to database's

    justneed2know
      I currently use Flex web services to request data from an sql server database (via a .net app) and bind the result set .net datatable to a flex datagrid. The datagrid has a datetime column that displays the local time at which the client created the record instead of the sql server datetime value. How can I change my datagrid records to show the database's datetime? Here's an articles related to this issue... but wasn't able to get it to work in my context: http://blog.shrefler.net/?p=13.

      Any help would be appreciated!
        • 1. Re: Convert displayed datetime in Flex app to database's
          Level 7

          "justneed2know" <webforumsuser@macromedia.com> wrote in message
          news:g980h7$m5f$1@forums.macromedia.com...
          >I currently use Flex web services to request data from an sql server
          >database
          > (via a .net app) and bind the result set .net datatable to a flex
          > datagrid.
          > The datagrid has a datetime column that displays the local time at which
          > the
          > client created the record instead of the sql server datetime value. How
          > can I
          > change my datagrid records to show the database's datetime? Here's an
          > articles
          > related to this issue... but wasn't able to get it to work in my context:
          > http://blog.shrefler.net/?p=13.
          >
          > Any help would be appreciated!

          Why not just send the request to create the record to the server _before_
          you do anything with it in Flex, then bring it back and display it in Flex?


          • 2. Re: Convert displayed datetime in Flex app to database's
            justneed2know Level 1
            Not sure if I understand your suggestion. When the user first creates the record, it is "timestamped" in sql server with the correct datetime (reflects sql server's data center timezone). Now, when the Flex app fetches the record (.net datatable binded to the Flex data grid), the datetime shows the local time at which the user created the record and not the true datetime stamp of the record in the database. Flex allows for easy binding of .net datatables to datagrid, which I've taken advantage of.

            Please suggest any work arounds...
            • 3. Re: Convert displayed datetime in Flex app to database's
              Garyl Woolworth Level 1
              Why don't you just return two datetimes back, one is the original timestamp of what the server made when it inserted the record, and the second was a preformatted date (could look the exact same as the timestamp) which was scoped as a string and not a date. This is the one you would show inside of your datagrid, scoping it as a string would ensure that none of Flex's date serialization is going to mess with it. And if you still need to manipulate it you still have your other reference which is scoped as the datetime.