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.

Karsten Pohnke About Karsten Pohnke
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

2 comments on “SharePoint CAML Query ignores Time in DateTime Filter

  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

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.