2 Replies Latest reply on Aug 12, 2008 6:27 AM by amthekkel

    Problem with date field

    amthekkel Level 1
      Hi,
      i am having problems with dates. I have a datagid that populates XML values. here are some example of the dates in the xml.
      1) 2008-08-05T00:00:00Z
      2) 2008-07-22T00:00:00Z
      3) 2008-08-04T23:00:00Z
      4) 2008-07-11T11:18:20Z

      I have function which is called when an item is clicked on the data grid. This function is supposed to take the above date and set the date of datefield in a summary panel. I kept getting xmllist@23232 to date conversion error if i tried to bind the datefield selectDate property to dataGrid value.

      I saw example of datefield being set using a date object. So i stored the above date in a string. The string displays the data fine only thing is it has the Time componenet(T) as well. So i split the string using string split function and using "T" as the delimiter. The problem is the 2nd and 4th dates in the above examples worked fine and displayed perfectly in the datefield.

      The 1st and 3rd dates however were displayed wrongly. I displayed the array that stored the split items and found that the date for the first one 2008-08-05T00:00:00Z was coming up as 2008-08-06 instead of 2008-08-05
      and for 2008-08-04T23:00:00Z was coming up as 2008-08-05 instead of 2008-08-04. i checked the string that was storing the data from the datagrid and that was storing the value correctly.

      any suggestions?

      cheers
      abhi