How to insert data in local time with SQL Client?

Created by Anthony Herra, Modified on Thu, 25 Feb 2021 at 05:16 PM by Anthony Herra

vNode SQL Client inserts data into Databases using UTC format to be able to process the data in a unified way regardless of its origin. However, you can use Moment Javascript library to modifiy the timestamp. 

The SqlClient version also includes Moment Timezone, which is used to parse dates in specific time zones and to change time zones that are given a moment object.

Example using SQL Server:

We will look for the History Transaction Query Script.
Look the following function into the script:


function _insertDataSqlServer(){

..

..

  rowValues+= sprintf("'%s'", row.getValue("ts").toISOString());

..

..

}

 

Change the last line for -> rowValues+= sprintf("'%s'",moment(row.getValue("ts").toISOString()).tz("America/Belize").format());

 

We have set America/Belize for the example, please feel free to adjust it to your preferred time zone.



Created by Anthony Herra.




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article