话不多说,直接上代码 public class Test { @org.junit.Test public void tets() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); //获取前月的第一天 for (int i = 0; i >-7; i--) { Calendar cal_1 = Calendar.getInstance();//获取当前日期 cal_1.add(Calendar.MON
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
一.获取传入日期所在月的第一天 public static Date getFirstDayDateOfMonth(final Date date) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); final int last = cal.getActualMinimum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, last); return ca
最近在写接口的时候老遇见从mysql中获取近几天数据的需求,获取日期这块不是很熟,网上看了很多但是代码量都太大,还是问了下别人,写了三行代码就解决了,不多说 贴代码了 下面是我获取近十天,每天的日期: List<String> dayList = new ArrayList<String>(); long start=1559356078000l; long end=1560133678000l; do { dayList.add(new DateTime(start).toStr
分类: SQL Server select GETDATE() as '当前日期',DateName(year,GetDate()) as '年',DateName(month,GetDate()) as '月',DateName(day,GetDate()) as '日',DateName(dw,GetDate()) as '星期',DateName(week,GetDate()) as '周数',DateName(hour,GetDate()) as '时',DateName(minute