/**
* 方法一
*/

String strDate = "2012-02";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
Date date = format.parse(strDate);
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
int days1 = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
System.out.println("天数为=" + days1);

/**
* 方法二
*/
int days2 = new Date(2012,02,0).getDate();
System.out.println("天数为=" + days2);

最新文章

  1. Windows Azure Virtual Machine (26) 使用高级存储(SSD)和DS系列VM
  2. 【leetcode】Spiral Matrix(middle)
  3. php发送post包
  4. pyenv 以及 virtualenv
  5. [POJ] #1006# Biorhythms : 最小公倍数/同余问题
  6. mybatis错误:Invalid bound statement (not found)
  7. IIS Server Farms集群负载
  8. 扩展ASP.NET MVC HtmlHelper类
  9. ajax 实现加载页面、删除、查看详细信息,以及bootstrap网页的美化
  10. 3016: [Usaco2012 Nov]Clumsy Cows
  11. api-gateway实践(14)前端签名密钥和后端签名密钥
  12. LocalBroadcastManager—创建更高效、更安全的广播
  13. 【RL-TCPnet网络教程】第26章 RL-TCPnet之DHCP应用
  14. 【OJ】抓牛问题
  15. 001_python单元测试
  16. 微信硬件平台(七)微信开发--如何存储并定时更新access_token
  17. object detection[YOLOv2]
  18. WCF 配置App.Config
  19. 用矩阵和待定系数法求数列的分析(复杂度log(n))
  20. Qt5编译oracle驱动教程

热门文章

  1. windows10和ubuntu16.04双系统下时间不对的问题 ZT
  2. “-webkit-appearance: none”按钮样式作用!
  3. Python常用函数、方法、模块记录
  4. HttpFox插件安装和打开教程
  5. 关于javascript自定义对象(来自网络)(最近几天不会的)
  6. MySQL数据库权限操作指南
  7. test「Python」流程&中文
  8. HTML5上传图片到ASP.NET.MVC
  9. 最新AFNetworking
  10. 什么是OAuth授权?