Returns the date represented by this duration ago. @return the computed date
()
| 144 | * @return the computed date |
| 145 | */ |
| 146 | @Override |
| 147 | public Date getAgo() { |
| 148 | final Calendar cal = Calendar.getInstance(); |
| 149 | |
| 150 | cal.add(Calendar.DAY_OF_YEAR, -this.getDays()); |
| 151 | cal.add(Calendar.HOUR_OF_DAY, -this.getHours()); |
| 152 | cal.add(Calendar.MINUTE, -this.getMinutes()); |
| 153 | cal.add(Calendar.SECOND, -this.getSeconds()); |
| 154 | cal.add(Calendar.MILLISECOND, -this.getMillis()); |
| 155 | |
| 156 | cal.set(Calendar.HOUR_OF_DAY, 0); |
| 157 | cal.set(Calendar.MINUTE, 0); |
| 158 | cal.set(Calendar.SECOND, 0); |
| 159 | cal.set(Calendar.MILLISECOND, 0); |
| 160 | |
| 161 | return new Date(cal.getTimeInMillis()); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Returns a helper for computing dates relative to now. |
nothing calls this directly
no test coverage detected