Search code examples
actionscript-3flex4flash-builderflexbuilder

flex get contents of arraycollection as Date


I use httpService to load data from mysql database. I put event.result on arraycollection. I need to convert one field to AS3 Date format, I can use "for each" too do that but as my arraycollection is big, it's take a long time. Do you a solution to accelerate this conversion.

The field I like to convert is like that : "2012-03-12 14:30:00"

Thanks for helping.


Solution

  • Have you seen the DateFormatter class?

    There is a function stringToDate which takes String argument and returns Date object. Pay attention formatString property.

    Best and correct way would be return date objects from backend.