'What is the opposite of now.date.addDays?
I am writing a little script whereby an action is fired if something has happened in the last few days.
So I have a database of posts and their dates, I want to select all of those records that are within say the last 2 days.
To select all that are within the last 2 days I need to know what the date was 2 days ago, so what is the opposite of now.date.addDays()?
It doesn't seem to exist! there is no removeDays()
Solution 1:[1]
Negative integers, there is no SubtractDays().
Solution 2:[2]
Now.Date.AddDays(-2)
Try use the above
Solution 3:[3]
You are correct, there is no explicit method for subtracting days, but you can pass in a negative value to the addDays method to handle this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Karl Anderson |
| Solution 2 | Christos |
| Solution 3 | MDiesel |
