·您当前的位置:首页 > 技术教程 > AS2与AS3技术 >

[AS3]as3.0的timeFormat日期和时间格式化处理的示例

时间:2012-10-18 18:36bbjxl.com
日期时间格式化,原Date格式:Fri Dec 11 09:00:01 GMT+0800 2009,格式化后的日期格式为:2009/12/11 周五 09:00

原Date格式:Fri Dec 11 09:00:01 GMT+0800 2009

格式化后的日期格式为:2009/12/11 周五 09:00

[AS3]as3.0的timeFormat日期和时间格式化处理的示例

  1. static public const DAYS:Array = ["周日","周一","周二","周三","周四","周五","周六"];  
  2. static public function getDateString(date:Date):String  
  3. {  
  4. var dYear:String = String(date.getFullYear());  
  5. var dMouth:String = String((date.getMonth() + 1 < 10) ? "0" : "") + (date.getMonth() + 1);  
  6. var dDate:String = String(date.getDate() < 10) ? "0" : "") + date.getDate();  
  7. var ret:String = "";  
  8. ret += dYear + "/" + dMouth + "/" + dDate + " ";  
  9. ret += DAYS[date.getDay()] + "";  
  10. ret += ((date.getHours() < 10) ? "0" : "") + date.getHours();  
  11. ret += ((date.getMinutes() < 10) ? "0" : "") + date.getMinutes();  
  12. // 极酷播放器Cuplayer想要获取秒的话,date.getSeconds() ,语句同小时、分  
  13. return ret;  

 

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器