Definition at line 12 of file TimeUtil.java.
Static Public Member Functions | |
| final long[] | asMonthRange (Date date) |
| final Timestamp | now () |
| final Timestamp | addDays (Timestamp date, long days) |
| final long | daysSince (Timestamp date) |
|
|
Return a long[] whose first element is the first msec and whose second is the last msec in the current month.
Definition at line 21 of file TimeUtil.java.
00022 {
00023 Calendar cal = GregorianCalendar.getInstance();
00024 cal.setTime(date);
00025 cal.set(Calendar.DAY_OF_MONTH, 1);
00026 cal.set(Calendar.HOUR, 0);
00027 cal.set(Calendar.MINUTE, 0);
00028 cal.set(Calendar.SECOND, 1);
00029 cal.set(Calendar.AM_PM, 0);
00030
00031 long[] range = new long[2];
00032 range[0] = cal.getTime().getTime();
00033
00034 cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + 1);
00035 range[1] = cal.getTime().getTime();
00036
00037 return range;
00038 }
|