我的代码:
var util:ISO8601Util = new ISO8601Util();
var date:Date = util.parseDateTimeString("2014-08-01T10:36:19+08:00");
var currentdate:Date = new Date();
var extended:String = util.formatExtendedDateTime( currentdate )
var basic:String = util.formatBasicDateTime( currentdate );
trace("currentdate:" + currentdate);
trace("=============================");
trace("Extended: "+extended);
我的parseDateTimeString代码:
public function parseDateTimeString( val:String ):Date
{
//first strip all non-numerals from the String ( convert all extended dates to basic)
val = val.replace( /-|:|T|Z/g, "" );
var date:Date = parseBasicDate( val.substr( 0, 8 ) );
date = parseBasicTime( val.substr( 8, 6 ), date );
return date;
}
输出:
currentdate:Wed Aug 27 15:00:02 GMT+0800 2014
=============================
Extended: 2014-08-27T07:00:02Z
如您所见,当前日期的时间是15:00:02:[3:00 PM]但是当我尝试将其转换为tru扩展ISO8601时输出06:48:42 [7:00 AM]
为什么扩展ISO8601的输出错误?
请帮帮我..
我只是在这里得到代码..
谢谢!