GMT time change in Handlebar
Can someone give me an example of adding or subtracting time for use in a delta export? The problem is that the delta time "lastExportDateTime" in the build URI section comes back with the time zone setup in my profile "EST" but comes back as GMT in the actual call. So now I have to drop 5 hours off the GMT for the delta export to work correctly in the target zone. Here is my URI that works correctly without changing the time:
/Transaction/findTransactionsByPeriodAndParametersExt?startDate={{dateFormat 'YYYYMMDD' date}}&endDate={{dateFormat 'YYYYMMDD' date}}&startTime={{substring lastExportDateTime "8" "14"}}&getFunctions=false
and here is the "preview":
/Transaction/findTransactionsByPeriodAndParametersExt?startDate=20220218&endDate=20220218&startTime=000000&getFunctions=false
which is correct as the template time has "000000" as the time. I cannot seem to find the code that will let me decrease the GMT time in this section: startTime={{substring lastExportDateTime "8" "14"}} - where what I need is {{lastExportDateTime - 5 hours}}
Thanks
Comments
Hi Paul,
With "dateFormat", you can specify the timezone you'd like the UTC/Zulu date/timestamp you'd like it to be converted to:
For your example, the expression would be the following:
This should evaluate like so:
Best Regards,
Dan
Something like this: /Transaction/findTransactionsByPeriodAndParametersExt?startDate={{dateFormat 'YYYYMMDD' date}}&endDate={{dateFormat 'YYYYMMDD' date}}&startTime={{substring (subtract 18000000 (dateFormat "YYYYMMDDhhmmss" lastExportDateTime)) "8" "14"}}&getFunctions=false
But the "substring" doesn't like the way I have nested the hour subtraction (in ms) and is expecting a string...
Hi PaulS - Thanks for posting to the Community, and sorry you haven't received any responses yet. I'm working on getting some eyes on your question internally. If you made progress on this in the meantime, please post an update.
-Kate
I was working on a response in parallel, but Dan beat me to the post! All I can add now is that you need to use the correct timezone values in all your dateFormat functions, and you probably want to use 'lastExportDateTime' and 'currentExportDateTime' instead of 'date'.
Here is my best guess for the relative URI you are trying to build.
Please sign in to leave a comment.