Skip to main content
Nintex Community Menu Bar

K2 SmartObject - DateTime SQL format

  • April 11, 2022
  • 1 reply
  • 289 views
  • Translate

Hi,

 

My post is around the fact that it appears that K2 Five uses the smalldatetime SQL data type when storing dates (so does not include milliseconds).

 

For example, it will store '2022-01-01 13:45:12', not '2022-01-01 13:45:12.543'.

 

I have a scenario:

  • I have a SmartBox SmartObject, created via the K2 Designer. It has a DateTime field.
  • It is possible that an external process outside of K2 can update the DateTime field directly (i.e. straight into the SQL table).
  • When this happens it updates the DateTime field in a format which I now understand is not familiar to K2 (so includes milliseconds).

Issue:

  • I want use the GetList method on the SmartObject to obtain all rows based using the DateTime as a parameter.

Example:

  • Here is the Date Time column from a SQL perspective:
    • 22627i4FAB36FA7A8A52BF.png
  • Using K2 Management (SmartObject tester), this is what it shows when obtaining the data:
    • 22628iE623606077707820.png

Problem:

  • How do I return the top two rows where the Date/Time is 22-04-07 08:52:17.677 ?
  • I have tried passing in different variations of the Date/Time, none of which work. For example:
    • 22629iA8470C25FB0A6EDD.png
    • 22630iA51983685A1219D7.png

 

 

I assumed K2 would do the conversion to small datetime on both sides and pick up the top two rows. So was surprised when I discovered it does that do that?

 

The obvious workaround is to amend the external process so that it stores the date as a small datetime. By following K2 standard and not including the milliseconds everything works fine.

 

I'm wondering if there is anything else that can be done? Rather not amend how the external process stamps the date time for several reasons (based on the requirements), unless we have to.

 

 

Thanks in advance

 

Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+10
  • Nintex Employee
  • 94 replies
  • April 19, 2022

Hi ConradMc,

 

Out of curiosity, can you change the return datatype (DateTime) column to Text type and see if that will get back the millisecond value?

 

I saw something similar to this a while back, maybe this KB will help (https://community.nintex.com/t5/Technical-Issues/SQL-Server-SmartObjects-drop-milliseconds-from-DateTime-values/ta-p/125132

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings