Why can I pass a string, but not a date?

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Why can I pass a string, but not a date?

    I have this custom component that at the moment just repeats the passed
    in value. It works if I pass in a string, but if I pass the date I
    actually want it does not work. I can not figure out why.

    dayFormat2 custom component.
    <mx:Script>
    <![CDATA[
    //Define public variables
    public var dayData:String;
    ]]>
    </mx:Script>

    <mx:DateFormatter id="dayNum" formatString="DD" />
    <mx:Label text="{dayData}" />

    -----------------------

    This Works.
    <ns1:dayFormat2 dayData="George" />

    This Does not work.
    <ns1:dayFormat2 dayData="{DayNum.format(dayCells.currentItem.date) }" />

    And neither does this. Of course for this version I change the dayData
    type to date in the custom component.
    <ns1:dayFormat2 dayData="{dayCells.currentItem.date}" />

    Just to make sure that the date exists as I expect. If I replace the
    dayFormat2 custome comment with a label, I get the dates just fine.
    <mx:Label text="{DayNum.format(dayCells.currentItem.date)}" />
    Ian Skinner Guest

  2. Similar Questions and Discussions

    1. Pass Date to Webservice
      Trying to pass a date to a webservice using a String formatted as '2007-10-30T12:00:00'. Webservice is set up expecting date as a Calendar. Get a...
    2. Pass XML string to a URL
      I need to pass a xml string to the URL. and return I will get a XML response. I need to pass the varible in an online form and send the result in...
    3. & in a string to pass through url param
      I am trying to add a list/menu in DW2004, and for each option I need to pass url paramerters the problem I am having is concantinating &amp; in a string...
    4. Pass a Date to stored procedure
      Hello. I have a stored procedure that accepts a Date field as one of its parameters. When I try to run the webservice that I wrote to call the...
    5. How to pass <br> string to webservice ?
      Greetings, I have asp.net page with a textbox. This textbox is used to pass values(mainly strings) to VB.NET webservice using...
  3. #2

    Default Re: Why can I pass a string, but not a date?

    Well I cant tell you why it works with "george" as the data, but I know that a
    date that is formated is not a date anymore, its just a string.

    I had this problem a little while back where I was trying to store a formated
    string as an attribute of my object but it never stored correctly. After
    asking around I found I had to write a function that could take my formated
    date string and construct a real date object to be used later.

    Hope that helps put you on the right track.

    simeon


    Simfluence Guest

  4. #3

    Default Re: Why can I pass a string, but not a date?

    I have tried it both ways, to pass the date itself and a formated string
    of the date, since the hard coded string worked. Neither provides any
    results. I just get a blank screen. No error, just a blank screen.

    Simfluence wrote:
    > Well I cant tell you why it works with "george" as the data, but I know that a
    > date that is formated is not a date anymore, its just a string.
    >
    > I had this problem a little while back where I was trying to store a formated
    > string as an attribute of my object but it never stored correctly. After
    > asking around I found I had to write a function that could take my formated
    > date string and construct a real date object to be used later.
    >
    > Hope that helps put you on the right track.
    >
    > simeon
    >
    >
    Ian Skinner Guest

  5. #4

    Default Re: Why can I pass a string, but not a date?

    add the bindable meta in your custom component...seems like that would
    be needed.

    //Define public variables
    [Bindable]
    public var dayData:String;

    Ian Skinner wrote:
    > I have this custom component that at the moment just repeats the passed
    > in value. It works if I pass in a string, but if I pass the date I
    > actually want it does not work. I can not figure out why.
    >
    > dayFormat2 custom component.
    > <mx:Script>
    > <![CDATA[
    > //Define public variables
    > public var dayData:String;
    > ]]>
    > </mx:Script>
    >
    > <mx:DateFormatter id="dayNum" formatString="DD" />
    > <mx:Label text="{dayData}" />
    >
    > -----------------------
    >
    > This Works.
    > <ns1:dayFormat2 dayData="George" />
    >
    > This Does not work.
    > <ns1:dayFormat2 dayData="{DayNum.format(dayCells.currentItem.date) }" />
    >
    > And neither does this. Of course for this version I change the dayData
    > type to date in the custom component.
    > <ns1:dayFormat2 dayData="{dayCells.currentItem.date}" />
    >
    > Just to make sure that the date exists as I expect. If I replace the
    > dayFormat2 custome comment with a label, I get the dates just fine.
    > <mx:Label text="{DayNum.format(dayCells.currentItem.date)}" />
    Ian Skinner Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139