SharePoint CAML Query ignores Time in DateTime Filter

I realized in a customer project that the results of my caml query does not match what we expected. The result was more, after we analyzed this issue, we got the point. The caml query ignored the time – it only used our filter with the date but not the time. After googling, we found really quick the missing step. You have to tell the filter to include the time. By default it does not include.



<where><geq><fieldref Name='CreateDate'></fieldref><value Type='DateTime' IncludeTimeValue='TRUE'>29.04.2014 07:00:00</value></geq></where>


That’s the important part: IncludeTimeValue=’TRUE’

The strange thing is, that it does not work. I also tried with OffsetDays Parameter, which did not work either. So maybe this is a bug? Does anyone know?

 

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.



About Karsten Schneider 304 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.

2 Comments

  1. Hello Karsten Pohnke,

    Have you found any solution to the above mentioned post, I am facing the same issue & there are multiple reports I’ve to pull from a list based on date & time.

    I am facing the same problem that time is not been considered I’ve tried including IncludeTimeValue=’TRUE’ in my CAML query but still no luck.

    I am working on MOSS 2007 version of SharePoint.

    If you have found any useful link / solution, then please do share it with me.

    Thank you
    Vivek Shelar.
    vivek.shelar@atos.net

    • Hi Vivek,
      i am sorry, i did not found another solution. But i guess, that there might be some jquery scripts available in the internet. If you get it done, would appreciate it if you share it.
      Merry Christmas to you and your family
      Kind regards
      Karsten

Leave a Reply

Your email address will not be published.


*