其他分享
首页 > 其他分享> > 获取昨天一整天时间

获取昨天一整天时间

作者:互联网

Calendar c1 = new GregorianCalendar();
c1.set(Calendar.HOUR_OF_DAY, 0);
c1.set(Calendar.MINUTE, 0);
c1.set(Calendar.SECOND, 0);
c1.add(Calendar.DAY_OF_MONTH,-1);
System.out.println(c1.getTime());
Calendar c2 = new GregorianCalendar();
c2.set(Calendar.HOUR_OF_DAY, 23);
c2.set(Calendar.MINUTE, 59);
c2.set(Calendar.SECOND, 59);
c2.add(Calendar.DAY_OF_MONTH,-1);
System.out.println(c2.getTime());

标签:set,getTime,DAY,获取,昨天,一整天,c2,Calendar,c1
来源: https://blog.csdn.net/weixb4818/article/details/114322961