I'm using a KeywordQuery in my SharePoint to get the list of tasks for a particular user, it works very well, only one thing that is going wrong is the date.

Basically above of that webapart with KeywordQuery, i have a normal search webpart which does almost the same, but a bit differently.

Both of the webpart have columns duedate, which represents the duedate of the task, NOW, in OOTB search webpart i have a normal and correct date for example : 5/31/2013

In KeywordQuery webpart i have the same task but the due date is incorrect, example: 5/30/2013 10:00:00 PM (pay attention to the day, it is one less), i really have no idea why i get this -1 day

DueDate is mapped to ows_duedate(Date and Time)

the second checkbox is checked in: to add this to all results

So anyone has any kind of idea WHY do I get -1?

  • 1
    What time zone are you in? What are the regional setting of your SharePoint server OS, SharePoint Server instance, Site collection, site, and your local PC? Dates have always been a problem in SharePoint, because they seem to be VERY US centric, meaning that at some level, regardless of your regional settings, dates may be interpreted as being in a US time zone, rather than in YOUR time zone, which may explain a day off. I have examples where a date shows one day off in a web part, but shows fine in the list view. This is a SharePoint bug, as far as I'm concerned. – teylyn May 31 '13 at 9:43
  • Hmm if so, how did you solve it? – Shkipper May 31 '13 at 11:27
  • You cannot solve a bug. There are workarounds for specific situations. My specific situation is not comparable to yours. In my case a publishing page field showed a different date in the page layout than what was displayed in the list view of the library. In my particular case I solved it by adding a helper column that duplicated the date, which then, magically (it seems) works in both the page layout and the list view. I don't know how to solve this for search web parts. Hence I have just posted a comment, not an answer. – teylyn May 31 '13 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.