October 22, 2013

SharePoint search query using date range

Task

This is a quick one. Task was to search SharePoint items with specific date range, say, Created date being between (and including) 1/1/2013 and 12/31/2013. Every place on the internet this was asked, answer was to use queries like this:

Created>=1/1/2013 AND Created<=12/31/2013. 

Well, it works, but why not use the range operator?


Solution

Use the range operator .. (two periods) like this:

Created=1/1/2013..12/31/2013

Note that range operator is inclusive, so you'll get items matching start and end dates of the range.

1 comment: