Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
2 replies
Subscribers
9 subscribers
Views
1385 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I am having an issue when importing data from a SQL table using the Query Databa
hayleyw
over 12 years ago
I am having an issue when importing data from a SQL table using the Query Database node that executes a SQL SELECT statement then transferring it to a mySQL table in appian using a Write to Datastore node and any dates that are imported and inserted into the table are consistantly 2 days earlier. Has anyone else come across this or know of any solutions?
Many thanks...
OriginalPostID-64351
OriginalPostID-64351
Discussion posts and replies are publicly visible
0
Christine
Appian Employee
over 12 years ago
This generally means that the db server and Appian are using diff time zone settings. Try converting the date to the correct time zone before write. Hope that helps
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 12 years ago
f you have a database that stores datetimes and does not convey information about what time zone those datetimes are in, then it's up to the application to make some assumptions about what time zone the datetime is in.
It's no different for Appian when our app is the one interfacing with the RDBMS. Appian takes care of the shifting to the context time zone when using datatimes stored in PVs, so the only touchpoints you need to worry about are those with the RDBMS: when storing datetimes to the RDBMS and retrieving datetimes from the RDBMS.
1. To feed datetimes to the database, take the datetime stored in GMT (e.g. the pv, the result of a function) and shift it to the time zone that the database expects. Going from GMT to a local time zone requires adding the offset to the GMT representation of the datetime. You can do this with the local() function:
local(pv!DATETIME_TO_INSERT_GOES_HERE,"Australia/Sydney")
2. When you retrieve a datetime from the RDBMS, you need to find the GMT equivalent of the datetime you get from it and store that in the PV for display purposes, otherwise Appian will assume the database is sending the data in GTM and will do an adjustment that will give you the wrong timestamp.
When you have a local datetime and you want to know the GMT equivalent of it, you subtract the time zone offset from that local datetime. The way you achieve this shifting (from a local time [RDBMS time zone] to the gmt equivalent) is using the gmt() function and passing the time zone representing the offset from GMT as the second parameter. So
gmt(pv!DATE_RETRIEVED_GOES_HERE,"Australia/Sydney")
Here is a screenshot explaining the insert:
forum.appian.com/.../79244
Here is a screenshot explaining the select:
forum.appian.com/.../79246
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel