Skip to main content
16-Pearl
February 20, 2024
Solved

Re: Convert Date time from SQL to TWX

  • February 20, 2024
  • 1 reply
  • 7116 views

HI All,

 

I would like to understand.

Why if I have a column of the Time type in the database where I only save the time.

JK_10565232_0-1707830317588.png

Results from DB looks like that Im using MY SQL SERVER

JK_10565232_1-1707830365863.png

 

 

And I invoke it on the TWX side

 

JK_10565232_2-1707830395645.png

 


Does the time move exactly 50 minutes and 39 seconds forward?

What's going on inside TWX with date data types?


I checked the location of the server and browser - we are in the same time zone.

How can I display exactly the same value like I have on DB?

    Best answer by JK_10565232

    Hello,

     

    I can help you without any problem. This is a very right way to change from datatables to SQL database. I have 8 years exp with Thingworx and datatables its not good way to store a large amount of information.

     

    1. First of all please check what kind of persistence provider you have. Each DB has own TWX version. 
    you can find it here:

    JK_10565232_0-1708426856326.png

    You need to select 'show system objects'

    JK_10565232_1-1708426909277.png

     

    I have MYSSQL persistence provider. You can find postgree persistence provider.

    JK_10565232_2-1708426983034.png

    I mentioned about it because if you have MYSQL persistence provider this kind of DB will be easier to connect with TWX. 

     

    Next you need to crate thing with DataBase or MYSQL Thing Template and you should choose Configuration Tab.

    JK_10565232_3-1708427121570.png

    You should provide all information about your DB. 

     

    After when you establish connection with your DB you are able to create SQL Query and Commands (Commands are dedicate for Insert, Update,Delete)

    Please don t mix SQL services with JS services inside one DB thing because it will create bottle neck with performance. 

    Let me know if you will have any additional questions.

     

    Best regards

    Jan

     



    1 reply

    16-Pearl
    February 13, 2024

    Hi @JK_10565232 

     

    ThingWorx supported UTC zone and you need to change it on your DB side as well, and if required to convert it to your local time zone then use it 

    16-Pearl
    February 19, 2024

    Hi @JK_10565232 

     

    Do you still require help with it?