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;    

    }

  • 相关阅读:
    Vi与Vim
    Linux文件压缩、打包、备份
    Linux文件与目录操作
    Linux文件权限与目录
    Linux学习笔记
    Android——复制项目出现Application Installation Failed
    《鸟哥的Linux私房菜》学习笔记0——计算机概论
    Android——自定义多击事件
    《跟孩子学Python》
    《简明Python教程》读书笔记
  • 原文地址:https://www.cnblogs.com/cuijinlong/p/6231796.html
Copyright © 2011-2022 走看看