How to filter a view based on the current date [Today]
If you ever need to filter a view based on calculation from Today’s date, it is pretty simple in SharePoint 2010. All you need is SharePoint Designer.
- Create a view through the SharePoint UI and set the filter to use [Today] as the filter value.
- Open the view in SharePoint Designer
- View the source code of the view. You will see the CAML used to create the view right within the source. You should see something like this:
- You can then calculate the number of days from the current date by using the OffsetDays property. The following example will filter the view to show all items within the next 30 days:
- Save the page and check out your new view.