码迷,mamicode.com
首页 > 其他好文 > 详细

开始日期结束日期获取中间所有月份

时间:2016-12-29 10:43:26      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:stat   core   shm   get   find   mapper   获取   format   reg   

    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;    

}

开始日期结束日期获取中间所有月份

标签:stat   core   shm   get   find   mapper   获取   format   reg   

原文地址:http://www.cnblogs.com/cuijinlong/p/6231796.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!