cancel
Showing results for 
Search instead for 
Did you mean: 

DocumentQuery: search date range with time

Erik_Venema
Champ in-the-making
Champ in-the-making

For my use case I need to find documents within a certain date time range. E.g. find all documents created between October 8th 0:00 and October 8th 12:00. When I use DocumentQuery.AddDateRange(fromDate, toDate) the time part is being ignored. Resulting in all documents from October 8th. 

Is there a way find documents that were created within a certain time range?

1 ACCEPTED ANSWER

Shane_Cook1
Star Contributor
Star Contributor

In my experience, the date range you are referring to represents the "Document Date" value you see on the keyword panel. "Document Date" is a true date field, not a date/time field, so you can't get time-specific with a document query. The date created is a property on the document object and is called "Date Stored" which has a full date/time stamp.   Assuming the "Document Date" on your documents is defaulting to the date created in OnBase, you could take the document query results you are currently getting and iterate through them. By checking the "Date Stored" property on each document, you would be able to filter the results down to the time range that you expected from your initial document query.

Cheers!

View answer in original post

1 REPLY 1

Shane_Cook1
Star Contributor
Star Contributor

In my experience, the date range you are referring to represents the "Document Date" value you see on the keyword panel. "Document Date" is a true date field, not a date/time field, so you can't get time-specific with a document query. The date created is a property on the document object and is called "Date Stored" which has a full date/time stamp.   Assuming the "Document Date" on your documents is defaulting to the date created in OnBase, you could take the document query results you are currently getting and iterate through them. By checking the "Date Stored" property on each document, you would be able to filter the results down to the time range that you expected from your initial document query.

Cheers!