This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.
There is an inconsistency between the SmartObject tester and SharePoint on the date field. In SharePoint site you can see the dates as '3/8/2018 6:51 PM' but when you run the SmartObject for the same document list in tester, it is showing as '3/9/2018 02:51AM'.
This was an all-in-one environment that was hosting the SQL server, K2 server and the Sharepoint Farm. It was also where the browser and SmartObject Service Tester tool was being executed from. It was determined that although the server was in the UTC-8 Pacific timezone, the Sharepoint site had its regional setting set to the UTC Dublin, Lisbon, London timezone (this setting is per site).
Although a SharePoint 'Date and Time' type > 'Date Only' field was being used; this was still stored in Sharepoint in a DateTime Format and can be verified with:
SELECT * FROM [SharepointContentDatabaseName].[dbo].[AllUserData] ORDER BY [tp_Created] DESC
It is likely the difference in the timezone settings that is resulting in this incorrect date.
The SmartObject of this case was created from SharePoint content service broker. Please also note that the manual creation of the Sharepoint 2013 service instance is not recommended/supported. Please use the K2 App to manage this service instance and the K2 Application to create SmartObjects:
https://help.k2.com/onlinehelp/K2ForSharePoint/UserGuide/4.7/default.htm#ServiceBrokers/SharePoint/SharePoint_2013_Broker.htm?Highlight="You cannot manually register"
After setting the Regional Settings for this site to match the server timezone, the date in the Sharepoint Library and SmartObject Service Tester tool is now matching.
Depending on the usage of this Date field; and if there is a timezone difference between the K2 Server and Sharepoint Regional Settings, you could also store this field in a Text field or use inline functions and conditional statements to cater for this difference.