AS3 中的日期格式

date format in AS3

我希望我的 AS3 代码检索 MYSQL table 中的特定日期。

我遇到了格式问题。 当我写的时候,在我的 AS3 代码中:

memberCombo.addItem( {label: "2015-06-23" } );
memberCombo.addEventListener(Event.CHANGE, checkComplete);

function checkComplete(evt:Event):void {

    var myVariables:URLVariables = new URLVariables();
        myVariables.username = evt.target.value;
        var myRequest:URLRequest = new URLRequest("http://www.***.com/sql_date.php");

    myRequest.method = URLRequestMethod.POST;
    myRequest.data = myVariables;
    trace(myRequest.data);

trace(myRequest.data); 结果 2015%2D06%2D23 所以它似乎在我的 SQL table 中搜索这个 2015%2D06%2D23 (所以它没有找到它,因为我的 table 中的日期格式是 YY-M-D) .

你知道我如何让我的 AS3 代码以这种格式在我的 SQL table 中查找日期吗:YY-M-D ?

谢谢


编辑

这是我所做的(但我犯了一个错误,因为它会产生错误):

    var myRequest:URLRequest = new URLRequest("http://www.****.com/sql_result.php");

myRequest.method = URLRequestMethod.POST;

    myRequest.data = myVariables;
    var myAS3Date;
    var myRequestString = "";
    myRequestString=dtAS3toMysql(myAS3Date);

function dtAS3toMysql( date:Date ):String {
    var s:String = date.fullYear + '-';

    // add the month
    if( date.month < 10 ) {
        s += '0' + ( date.month + 1 ) + '-';
    } else {
        s += ( date.month + 1 ) + '-';
    }

    // add the day
    if( date.date < 10 ) {
        s += '0' + date.date;
    } else {
        s += date.date;
    }

    return s;
}
public static function dtMysql2AS3( s:String ):Date {
        var a:Array = s.split( '-' );
        return new Date( a[0], a[1] - 1, a[2] );
    }


public static function dtAS3toMysql( date:Date ):String {
    var s:String = date.fullYear + '-';

    // add the month
    if( date.month < 10 ) {
        s += '0' + ( date.month + 1 ) + '-';
    } else {
        s += ( date.month + 1 ) + '-';
    }

    // add the day
    if( date.date < 10 ) {
        s += '0' + date.date;
    } else {
        s += date.date;
    }

    return s;
}