3 Replies Latest reply on May 19, 2008 5:59 PM by ntsiii

    Date in the Datagrid

    leoalvesmachado
      Hi everyone

      I recieve from a Java back end application a list of objects to populate my Datagrid. One field of these objects is "creation time" - a long value that holds the time when the object was created. How do I convert this long to a Date in my Datafield?

      thanks in advance
        • 1. Re: Date in the Datagrid
          anoweb
          You could try, new Date(Date.parse(<your java value here>))

          I am in a similar situation but I wasn't sure how to get it done. So I just ended up doing a .ToString on the date/time object before giving to it to Flex.
          • 2. Re: Date in the Datagrid
            javamonjoe Level 1
            You need to specify a label function for your column. With the label function you may format your data in any way you wish without actually changing the data.
            • 3. Re: Date in the Datagrid
              ntsiii Level 3
              If it is a long, then it must be something likd "ticks" or milliseconds since som data. I do not know java well enough, or when it starts its dates, but it may not be the same a AS.

              So I thinkAnoweb's idea, convert the long into some recognizable date string on the server is a good idea. i am standardizing on the ISO date string format:
              YYYY-MM-DDThh:mm:ss-[timezoneoffset]

              Note that the AS data.parse cannot read that directly drat it, so I have a library ov conversion funtions to work with that format.

              Tracy