Discussion

How to subtract days from a date

Has anyone done this? addDate doesn't allow negative values so I'm kinda stuck now... Please help.

***Updated by moderator: Marissa to close post***
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

November 20, 2008 - 12:18pm

Have you tried using the function addDays? I think it works.

November 20, 2008 - 1:53pm

rex.aggabao wrote: Has anyone done this? addDate doesn't allow negative values...

You can use DateTimeUtils.addToDate(thedate,daysBackStr ,"","","");

Note that all of the parameters are strings, so you can specify a negative "-1" etc.