2013-03-15 93 views
0

嗨,我有一个csharp应用程序和一个flex应用程序,并在我得到currentdatetime和格式。与我使用csharp应用程序时得到的毫秒数相比,我在flex应用程序中获得的millisecoonds似乎正在落后。我不知道如果我做错了什么,但这是我的柔性功能,它格式化我的日期。请让我知道,如果这是以正确的方式获取以下日期格式yyyy/MM/dd hh:mm:ss.fff在flex中。从日期获取毫秒Flex

private function GetCurrentDateTime():void 
{ 
      var dateFormatter:DateFormatter = new DateFormatter(); 
      dateFormatter.formatString = 'YYYY/MM/DD HH:NN:SS'; 

      var dtCurrent:Date = new Date();     
      currDateTime = String(dateFormatter.format(dtCurrent) + '.' + dtCurrent.getMilliseconds());        
} 
+0

最近的Spark替代方法是[DateTimeFormatter](http://help.adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/spark/formatters/DateTimeFormatter。 HTML),我相信它必须是小写的y和d。但是你可以在文档中找到这些信息。 – RIAstar 2013-03-15 09:19:42

+0

“legging Behind”是什么意思?你的意思是说C#和Flex给出了两个不同的值?除非你调用这两个函数来在[同一台机器上]完全同时检索当前的日期/时间,这不是预期的吗? – JeffryHouser 2013-03-15 12:26:38

回答