--- 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/
 


Reply via email to