加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex如何获取到当前月份的最后一天

发布时间:2020-12-15 05:18:25 所属栏目:百科 来源:网络整理
导读:? ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="defaultYm()" mx:Script ![CDATA[ import mx.controls.Alert; import mx.states.SetStyle; import flash.sampler.NewObje
?
<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="defaultYm()"> 
 
<mx:Script> 
 <![CDATA[
 	import mx.controls.Alert; 
  import mx.states.SetStyle; 
  import flash.sampler.NewObjectSample; 
  
  private function  defaultYm():void{ 
     var nowDate:Date = new Date();
     var nowyear:String = nowDate.getFullYear().toString();
     var nowmonth:String = (nowDate.getMonth()+1).toString().length == 1?"0"+(nowDate.getMonth()+1).toString():(nowDate.getMonth()+1).toString();
   
     var lastdaysOfMonth:String = daysOfMonth(nowyear+nowmonth);  
     Alert.show("当月最后一天"+lastdaysOfMonth);
  } 
  
   function daysOfMonth(Month):String{   
	   var currentMonth=new Date(Month.substring(0,4),Month.substring(4,6),1);   
	   var lastMonth=new Date(Month.substring(0,6)-1,1);   
	   var diffDays=currentMonth-lastMonth;     
	   return ""+(diffDays/( 24 * 60 * 60 * 1000));   
}   
 ]]> 
</mx:Script> 
  
</mx:Application> 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读