http/1.0 calendar

来源:互联网 发布:足球数据分析大师系统 编辑:程序博客网 时间:2024/05/22 03:02

http/1.0 一次连接一次请求

http/1.1 一次连接多次请求 


2016年2月有多少天?

思路1:生成2016-3-1的calendar,然后向前add一天,get(DAY_OF_MONTH)。

思路2:生成2016-1-31的calendar,然后向后add一个月,get(DAY_OF_MONTH)

思路3:生成2016-随便哪月那天的calendar,然后获取getLeastMaxium(DAY_OF_MONTH)


calendar

Calendar calendar = Calendar.getInstance();calendar.set(2016, 7, 6);//注意月份是0-11calendar.add(Calendar.DAY_OF_MONTH,1);calendar.roll(Calendar.DAY_OF_MONTH, 1);calendar.setTimeInMillis(System.currentTimeMillis());try {SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");Date date2 =format.parse("2016-8-6 10:03:02");calendar.setTime(date2);} catch (ParseException e) {e.printStackTrace();}




0 0
原创粉丝点击