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;    

    }

  • 相关阅读:
    hibernate中的缓存和快照
    hibernate中的主键生成策略
    static静态代码块的使用(单例)
    spring aop简单实现
    spring 中常用注解
    spring 配置文件中<property> 的作用
    spring配置文件中引入其他配置文件的方法
    3-29 from xx import xx
    3-28 遇到的问题及解决方法
    3-27 思考以及self本质
  • 原文地址:https://www.cnblogs.com/cuijinlong/p/6231796.html
Copyright © 2011-2022 走看看