宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应
您当前的位置: > 博客2 > AS2与AS3技术

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

2016-10-13 00:16:48 点击量:36 标签: 收藏本文

原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;  

 

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室