Skip navigation
Currently Being Moderated

Date nodes in XML

Apr 5, 2012 3:38 PM

I'm working with XML in AS3. I'm loading in some xml that has dates in a format like:

 

2011-1-12-10-00-a

 

I am converting those to actual Flash Date so I can compare them and use the methods of the Date class, etc. I would prefer to convert them once and then store them back in the XML node they came from.

 

Is it possible to store complex values like date or what have you in an XML?

 
Replies
  • kglad
    72,213 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 5, 2012 5:57 PM   in reply to Rothrock

    you can but not as a date object.  you have to serialize your date object, save that to your xml and then unserialize your date object.

     

    that may be less efficient than using a string to save to your xml and converting that back to ta date object.

     
    |
    Mark as:
  • kglad
    72,213 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 6, 2012 3:42 PM   in reply to Rothrock

    yes, or more directly use:

     

    var ms:int=date.getTime();

     

    var newDate:Date = new Date(ms);

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points