zoukankan      html  css  js  c++  java
  • 开始日期结束日期获取中间所有月份

        public long[] findCustomerCoReg(StatisticsQuery query){        

         Date startDate = query.getStartDate();        

         Date endDate = query.getEndDate();        

         Calendar c = Calendar.getInstance();        

         List<Long> list = new ArrayList<Long>();

                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");

               for(;startDate.getTime() <= endDate.getTime();){          

                Map<String, Object> params = new HashMap<String, Object>();            

                String _startDate = df.format(startDate);            

                       c.setTime(startDate);            

            c.add(Calendar.WEEK_OF_MONTH, 1);            

                       startDate = c.getTime();            

                       String _endDate = df.format(startDate);            

                       params.put("startDate", _startDate);            

                       params.put("endDate", _endDate);            

                       long l = customerMapper.findCustomerCoReg(params);            

                      list.add(l);        

               }       

               long[] ret = new long[list.size()];        

               for(int i =0; i < list.size(); i++){            

                          ret[i] = list.get(i);        

                }

                     return ret;    

    }

  • 相关阅读:
    BZOJ1299 [LLH邀请赛]巧克力棒
    BZOJ1046 [HAOI2007]上升序列
    BZOJ1798 [Ahoi2009]Seq 维护序列seq
    BZOJ2045 双亲数
    BZOJ2301 [HAOI2011]Problem b
    BZOJ1021 [SHOI2008]Debt 循环的债务
    BZOJ2618 [Cqoi2006]凸多边形
    BZOJ1069 [SCOI2007]最大土地面积
    BZOJ1051 [HAOI2006]受欢迎的牛
    2017年09月23日普级组 环
  • 原文地址:https://www.cnblogs.com/cuijinlong/p/6231796.html
Copyright © 2011-2022 走看看