2 Replies Latest reply on Jul 1, 2007 3:25 PM by africanshox

    Formatting Dates on a ComboBox

      I'm using AMFPHP to populate a combobox with an array of dates which are calculated and formatted in PHP and then displayed in Flex. i initially formatted the dates so that they could be more readable i.e june 2007.

      the functionality i want to achieve is similar to this site but obviously in flex.


      so the code i wrote in php looks like this

      function getDate()

      $currentDate = date('n');
      $increment = 12 - $currentDate;
      list($hour, $minute, $second, $month, $day, $year) = split(':', date('h:i:s:m:d:Y'));
      // print out depending on number of months remaining
      for ($i = 0; $i <=$increment; ++$i) {
      $timestamp = mktime($hour, $minute, $second, $month + $i, $day, $year);
      $formattedDate = date('F Y',$timestamp);

      $dateList[ ]=$formattedDate;



      based on the current month....the result returned will be
      June 2007,July 2007,August 2007,September 2007,October 2007,November 2007,December 2007

      the issue now is that while this format is easily readable, it becomes problematic when using it against any queries to the database so that i can retrieve the number of courses taking place in a given month.

      the obvious step to take would be to return the raw format to flex and then use the date formatter to convert the dates but the n i would have to convert them back again to something like 01/2007 to sue in an SQL query.

      i really need help with this and im sure the solution is probably simpler than i think....