I’m trying to implement this method:
/**
* Adds the given span to the given date and returns a new date.
*/
public java.util.Date add(java.util.Date d, long span, java.util.concurrent.TimeUnit unit) {
// ...
}
I can just do a switch on the unit. Is there a library that does this? apache commons? Joda?
You don’t need to switch on the unit – just ask it for the right number of milliseconds:
On the other hand, I’d definitely try to use Joda instead 🙂