日期时间格式化timeFormat知识
更新时间:2012/10/25 点击:1505次
原Date格式:FriDec1109:00:01GMT+08002009 格式化后的日期格式为:2009/12/11周五 09:00 ============= staticpublicconst DAYS:Array =[周日,周一,周二,周三,周四,周五,周六]; staticpublicfunctiongetDateString(date:Date):String { var dYear:String =S原Date格式:Fri Dec 11 09:00:01 GMT+0800 2009 格式化后的日期格式为:2009/12/11 周五 09:00 ============= static public const DAYS:Array = ["周日","周一","周二","周三","周四","周五","周六"]; static public function getDateString(date:Date):String { var dYear:String = String(date.getFullYear()); var dMouth:String = String((date.getMonth() + 1 < 10) ? "0" : "") + (date.getMonth() + 1); var dDate:String = String(date.getDate() < 10) ? "0" : "") + date.getDate(); var ret:String = ""; ret += dYear + "/" + dMouth + "/" + dDate + " "; ret += DAYS[date.getDay()] + ""; ret += ((date.getHours() < 10) ? "0" : "") + date.getHours(); ret += ((date.getMinutes() < 10) ? "0" : "") + date.getMinutes(); // 想要获取秒的话,date.getSeconds() ,语句同小时、分 return ret; }