Another solution is to use the Date object's regular methods. So it
would look like this:
Date aWeekAgo = new Date();
aWeekAgo.setDate(aWeekAgo.getDate() - 7);
I know that these methods have been deprecated since JDK 1.1, but they
are valid on the client side (i.e. in Javascript), so you can still
use them. Another way is to mess around with the DateTimeFormat, but
that'll get hairy, quickly.
Regards,
Arthur Kalmenson
On Aug 8, 6:16 pm, "Larry White" <
ljw1...@gmail.com> wrote:
> I would try something like this:
> 0. Create a constant MSECS_PER_DAY as 1000*60*60*etc.
> 1. get the time in milliseconds from the date: long time = date.getTime();
> 2. multiply your MSECS_PER_DAY by 7 (for 7 days)
> 3. Subtract that value from your time value:
> 4. create a new date and set the time: date2.setTime(n);
>