ActionScript时间正确性校验

import mx.validators.DateValidator; 

import mx.events.ValidationResultEvent;

public function dateCheck(year:String, month:String, day:String):int {
  
    var datavalidator:DateValidator = new DateValidator();
    datavalidator.property = "text";
    datavalidator.inputFormat = "YYYYMMDD";
  
    var value:Object = {};
    value.day = day;
    value.month = month;
    value.year = year;
  
    var result:ValidationResultEvent = datavalidator.validate(value);
   
    if(result.results == null) {
        Alert.show('Validation Succeeded!');
        return 0;
    } else {
        Alert.show('Invalidation Date!');
        return -1;
    }
 }

你可能感兴趣的:(actionscript)