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 

0

Comments

4 comments
Date Votes
  • Official comment

    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:

    {{dateFormat "YYYYMMDDHHmmss" lastExportDateTime "" "US/Eastern"}}

    For your example, the expression would be the following:

    /Transaction/findTransactionsByPeriodAndParametersExt?startDate={{dateFormat 'YYYYMMDD' date}}&endDate={{dateFormat 'YYYYMMDD' date}}&startTime={{dateFormat "YYYYMMDDHHmmss" lastExportDateTime "" "US/Eastern"}}&getFunctions=false

    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...

    0
  • 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

    0
  • 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.

    /Transaction/findTransactionsByPeriodAndParametersExt?startDate={{dateFormat 'YYYYMMDD' lastExportDateTime '' 'US/Eastern'}}&endDate={{dateFormat 'YYYYMMDD' currentExportDateTime '' 'US/Eastern'}}&startTime={{dateFormat 'HHmmss' lastExportDateTime '' 'US/Eastern'}}&endTime={{dateFormat 'HHmmss' currentExportDateTime '' 'US/Eastern'}}&getFunctions=false
    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post