I have a CAML query, in which the <Where>
node looks like:
<Where>
<Leq>
<FieldRef Name='PublishedDate'/>
<Value Type='DateTime'>
<Today/>
</Value>
</Leq>
</Where>
Edited For Clarity:
The same query using <Now />
did not return any list values at all.
<Where>
<Leq>
<FieldRef Name='PublishedDate'/>
<Value IncludeTimeValue='TRUE' Type='DateTime'>
<Now />
</Value>
</Leq>
</Where>
I tried this with and without the IncludeTimeValue
parameter. There are items in the list that were published months ago, so if this were a time zone issue, there should still be returned items.
Why would no values be returned?
The only similar article I could find is Using the Now() function in CAML Query? but that article does not solve my time stamp problem. Any ideas?
Edit:
After running the query in U2U my results have been validated. See the images below.
The CAML Query using <Today/>
:
The results from the query using <Today/>
(note the date stamps go back months):
The results of the query after changing <Today/>
to <Now/>
:
There are no results returned using <Now/>
... I'm trying to filter blog posts based on the PublishedDate. The time stamp needs to be included in this comparison, requiring me to use <Now/>
.
<Now/>
returns the desired results, but why doesn't the built-in<Now/>
function work properly?