DateTime column display previous date than one which was selected previously via control


Badge +11


 

Symptoms


When using SQL SmO and exposing DateTime or Date type column on view via Date Picker control K2 server performs time zone conversion which may lead to displaying previous date in views afterwards in certain scenarios. This happens even if underlying data type is Date and there is no "Date" data type on SmO/control level in versions prior to 4.6.9
 

Diagnoses


This is known issue which has been addressed by introducing the new functionality for the DateTime and also new Date only data type which has been implemented starting from 4.6.9 and onwards.

The DateTime value is stored in SQL in the server time relative to the user time. This means the time that the server clock would show at the point in time that the clock on the client browser showed the time selected in the calendar control. From 4.6.9 onwards, you can use either Date or DateTime in SF. When only entering a Date but using a DateTime type the time will be selected as midnight (00:00) in the client browser time zone.

The conversion is performed by K2 as follows:
Local date time in the control >>converted>> to UTC (via JavaScript in the browser) >>transferred>> IIS (SmartForms) >> converted >> to server time >>transferred>> K2 host server >>transferred>> SQL Server

The Date type does not contain a time or time zone and no conversions are done anywhere.

The reason you do not see the option to select a time in SF even when the type is DateTime is because the time selection part of the calendar is omitted by default for backwards compatibility. But to add time user only needs to edit the view and add the time picker to the control while removing the short date style.

For versions prior to 4.6.9 workaround to this issue is to adding 12 hours to selected date using hidden data field/expression (number you add may need to be adjusted depending on your time zones).
 

Resolution

For versions prior to 4.6.9 consider implementing workaround by adding 12 hours to selected date using hidden data field/expression or consider upgrading to K2 4.6.9 or newer. This issue has been addressed in 4.6.9 and newer versions of K2 (see details above).




 

0 replies

Be the first to reply!

Reply