I just tested this and it works fine for me, which leads me to believe it’s not timezone related. Is it adding 7 hours every time or is just in this one case?
In the second record we’d expect to see 1:32pm if it were adding 7 hours every time. Instead there’s a difference of 17 hours. Have you gone through it step by step in the debugger to see what’s going on?
I was able to replicate your issue by changing the timezone of the api worflow to UTC. In this instance the hour is set in UTC so when I view it my timezone (GMT+8) I see it as the extracted hours value + 8 . Maybe the same is happening in your case, although that doesn’t explain the -7 change. What is the origin of this workflow’s trigger…browser, webhook, db trigger, etc?
Jesus christ, this is definitely not the best way to be doing whatever it is you’re trying to do.
Why aren’t you just setting the date field to the API’s response directly? If it detects it as a text, change the response type to date by clicking ‘manually enter API response’ on the API call, then saving, then setting the relevant field to date.
I promise you’ll kick yourself for writing this expression!
That’s a great tip I didn’t know about. However, the data from our API comes back encrypted as a single field. Then we need to decrypt it and so we get a single JSON string instead.
Oh, well that is certainly an edge case. I feel your pain.
If you need to do this in multiple places in your app, I’d suggest you put the logic in a custom event that takes the string and returns the date (so, add a return value of type date, and in the custom workflow, just return date = Current date time change years to… etc etc. Then, you don’t need to rebuild the expression multiple times.