...
|
...
|
@@ -65,9 +65,14 @@ public class DateUtil { |
|
|
}
|
|
|
|
|
|
public static void main(String[] ars){
|
|
|
int endTime= DateUtil.getLastDayInt(6);
|
|
|
System.out.println(endTime);
|
|
|
int beginTime=DateUtil.getLastDayInt(7);
|
|
|
System.out.println(beginTime);
|
|
|
|
|
|
String s = DateUtil.long2DateStr(1449134435000L, "yyyy-MM-dd");
|
|
|
System.out.print(s);
|
|
|
System.out.print(">>>>>>>>>>"+getCurrentTimeSecond());
|
|
|
System.out.println(s);
|
|
|
System.out.println(">>>>>>>>>>"+getCurrentTimeSecond());
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -203,14 +208,14 @@ public class DateUtil { |
|
|
|
|
|
public static int getLastDayInt(int lastDay) {
|
|
|
Calendar time = Calendar.getInstance();
|
|
|
time.add(Calendar.DAY_OF_YEAR,1-lastDay);
|
|
|
time.add(Calendar.DAY_OF_YEAR,-lastDay);
|
|
|
time.set(time.get(Calendar.YEAR),time.get(Calendar.MONTH),time.get(Calendar.HOUR_OF_DAY),0,0,0);
|
|
|
return (int) (time.getTime().getTime()/1000);
|
|
|
}
|
|
|
public static int getLastDayInt(int time,int lastDay) {
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTimeInMillis(time*1000);
|
|
|
calendar.add(Calendar.DAY_OF_YEAR,1-lastDay);
|
|
|
calendar.add(Calendar.DAY_OF_YEAR,-lastDay);
|
|
|
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.HOUR_OF_DAY),0,0,0);
|
|
|
return (int) (calendar.getTime().getTime()/1000);
|
|
|
}
|
...
|
...
|
|