AMFDateConverter.as 618 B

123456789101112131415161718192021222324252627282930
  1. package com.imt.intimamedia.helpers
  2. {
  3. import mx.formatters.DateFormatter;
  4. public class AMFDateConverter
  5. {
  6. public function AMFDateConverter()
  7. {
  8. }
  9. public static function convert( value : * ) : Date
  10. {
  11. if( value is Date )
  12. {
  13. return value;
  14. }
  15. var array : Array = value.split( "-" );
  16. if( array.length == 3 )
  17. {
  18. var date : Date = new Date( array[0], array[1] - 1, array[2] );
  19. date.setHours( 12,0,0,0);
  20. return date;
  21. } else {
  22. return null;
  23. }
  24. }
  25. }
  26. }