Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Time difference when posting from Designer to Gallery that a string field does not resolve

ddiesel
13 - Pulsar
13 - Pulsar

I am having trouble getting my workflow to output the right date/time when posting to the server. I am in PST but the server is EST so my times are off by 3 hours.

 

In my workflow there is a field indicating "Date Update Date/Time" that uses this formula to correct the date:

 

DateTimeAdd(datetimenow(),-3,"Hours")

 

It works when running in designer as showing 4:00 AM instead of the local time of 7:00 AM but when I run in the gallery, it returns 10:00 AM instead of the desired 7:00 AM.

 

 

Next I tried to subtract 6 hours but it still returned 10:00 AM.

DateTimeAdd(datetimenow(),-6,"Hours")

 

 

Finally, I converted the field to a string field but it still is forcing the date 3 hours ahead --- which truly baffled me.

 

Any insight to help me resolve this would be greatly appreciated.

3 REPLIES 3
gnans19
11 - Bolide
Gallery gets server time which is EST. Your designer gets your local time.
ddiesel
13 - Pulsar
13 - Pulsar

I ended up using a find and replace to force the output to show the right time. I'm going to do some further reading here in the community to see if I can understand how to adjust for the time difference with a formula.

adm510
11 - Bolide

Do you know the name of your Alteryx server? If so, you could use that to differentiate when your workflow is being run locally vs on the server.  From there, you can use an if statement to decide if you need to subtract 3 or 6 hours.

 

For example (make sure to replace alteryx_svc with your server name(s)):

 

IF ReadRegistryString('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName', 'ComputerName') = "alteryx_svr" THEN
   DateTimeAdd(datetimenow(),-3,"Hours")
ELSE
   DateTimeAdd(datetimenow(),-6,"Hours")
ENDIF

If you have multiple servers, then find out if your IT dept uses a different naming conventions for servers that you might be able to check against, for ex contains([servername],"_svr")

 

 

EDIT:

Even better, I just realized that Windows stores the current time zone in the registry, so rather than mapping computer/server names to time zones, just check the timezone directly

 

ReadRegistryString('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation', 'TimeZoneKeyName')

 

Labels