1 Reply Latest reply on Sep 21, 2012 3:41 AM by jfb00

    Need help creating a date from a specific year


      Flex newbie here.


      I am trying to display a line on a chart only if it is after Nov 1st of the current year displayed in the chart.  If I hard code it, here is what works:



      var indemDispDT:Date = new Date(2012,10,01,00,00,00);

      I then display a line only if the date on the chart is after 20121101 00:00:00 - if (item.historyDt > indemDispDT then display the item on the chart



      I need it to work like this:


      var currYr:Number = item.historyDt.fullYear;

      var indemDispDT:Date = new Date(currYr,10,01,00,00,00);


      where historyDt is a date value from a loop returned from a db query back to the server


      When I try that code, the chart freezes up.  I have been searching these forums and google for hours trying to find the answer, any help would be greatly appreciated.



        • 1. Re: Need help creating a date from a specific year
          jfb00 Level 3


          Someone just help me to fix this issue:


          <?xml version="1.0" encoding="utf-8"?>

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"


                         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="testDate()">


                  <!-- Place non-visual elements (e.g., services, value objects) here -->




                      import mx.controls.Alert;

                      import mx.utils.ObjectUtil;


                      private function testDate():void{

                          var currYr:Number = 2009;

                          var date1:Date = new Date(2010,10,01,00,00,00,00);

                          var date2:Date = new Date(currYr,10,01,00,00,00);


                          if (ObjectUtil.dateCompare(date1, date2) > 0) {

                              //date1 > date2

                              Alert.show("Show Chart");

                          } else if (ObjectUtil.dateCompare(date1, date2) < 0) {

                              //date2 > date1

                              Alert.show("No Chart");

                          } else {

                              //date2 == date1

                              Alert.show("No Chart");








          I hope this help.