Skip to main content

This is really strange...

 

I have a SO pointed at a SQL database where it pulls in two dates from the table.

 

In both cases, when looking at these records in a list view, the date in the list view is one day behind the actual date in the database.  As we're talking about effective dates for insurance, all these dates are the first of the month.

 

So, for example, if the record in the SQL database for ID 12345 is 12/01/2016 the date showing on my list view is 11/30/2016.  Or, if the date is 01/01/2017 the date on my list view is 12/31/2016. 

 

I've confirmed that there are no expressions taking a day away on the column, and that the fields are mapped correctly in the smart object...

 

Anyone have any thoughts on this one?

 

Rob

 

1.  How is this data stored in SQL?  Which SQL data type is being used?


2.  Which SmartObject Property type is in use?  Date or DateTime?


3.  Is the SQL server and K2 Server/K2 Web Server in the same time zone?


4.  If the Client Browser and K2 Server/K2 Web Server in the same time zone?


Might be caused by differences in the server and user time-zones.  I've seen this happen when a Date is stored in a SmartObject and displayed using a DateTime field with formatting to display only the date part.  What happens is that K2 adds a time of midnight to the date when assigning it to a DateTime field.  This is midnight relative to the server.  When this DateTime is sent to the user (who is further "west" of the server), the DateTime is converted to the user's local date/time (which is yesterday sometime).  But since the time isn't being displayed, it appears that the date is one day off.

 

Example:  User 2 time-zones "west" of the K2 Server

Date in SmartObject: 1/5/2016

Date/Time reported by server:  1/5/2016 00:00:00

Date/Time for the local user:  1/4/2016 22:00:00

Date seen in DateTime field with date-only formatting:  1/4/2016

 

In my case, the solution was to change the date type of the control to be Date instead of DateTime. 


Reply