1.获取近十二个月 var dataArr = []; var data = new Date(); var year = data.getFullYear(); data.setMonth(data.getMonth()+1, 1) //获取到当前月份,设置月份 for (var i = 0; i < 12; i++) { data.setMonth(data.getMonth() - 1); //每次循环一次 月份值减1 var m = data.getMonth() + 1; m = m…
select * from( select sum(case MONTH(purchase_date) when '1' then SumMoney else 0 end) as January,sum(case MONTH(purchase_date) when '2' then SumMoney else 0 end) as February,sum(case MONTH(purchase_date) when '3' then SumMoney else 0 end) as Marc…
最近在写接口的时候老遇见从mysql中获取近几天数据的需求,获取日期这块不是很熟,网上看了很多但是代码量都太大,还是问了下别人,写了三行代码就解决了,不多说 贴代码了 下面是我获取近十天,每天的日期: List<String> dayList = new ArrayList<String>(); long start=1559356078000l; long end=1560133678000l; do { dayList.add(new DateTime(start).toStr…