I had already posted a solution some posts ago, but this will be the solution to you:

public class UserVO implements ValueObject
{

private var _activeStartDate : Date;
private var _activeEndDate : Date;

public function get activeStartDate():Date
{
      return _activeStartDate;
}
public function set activeStartDate(value:*):void
{
    _activeStartDate = new Date(value);
}

public function get activeEndDate():Date
{
      return _activeEndDate ;
}
public function set activeEndDate(value:*):void
{
    _activeEndDate = new Date(value);
}

}

And now you can pass whatever you want from Php to Flex (see the langref for more info).

Oriol.

2006/8/23, Stefan Schmalhaus <[EMAIL PROTECTED]>:
--- In [email protected], Nate Hardt <[EMAIL PROTECTED]> wrote:
>
> Probably whoever designed the date class wanted to represent a date
> down to milliseconds, whereas the unix timestamp only represents a
> date down to the second.

I finally decided to use two date properties on my value objects: One
date property holds the date as Unix timestamp, the other one holds
the date as a Flex Date() object. When the date is retrieved from
MySQL it is retrieved as a Unix timestamp (UNIX_TIMESTAMP()).

For example, in Flex/Cairngorm my UserVO has these date properties:

public class UserVO implements ValueObject
{
   public var activeStartDate : Date;
   public var activeStartDateUnix : Number;
   public var activeEndDate : Date;
   public var activeEndDateUnix : Number;
}

Whenever I need a date property as Flex Date() object, I do
conversions like these:

model.selectedUser.activeStartDate = new
Date(model.selectedUser.activeStartDateUnix*1000);

model.selectedUser.activeEndDate = new
Date(model.selectedUser.activeEndDateUnix*1000);

I'd be happy if anyone could come up with a better solution.

Stefan






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/




__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to