Create a parameter for the past 24 hours in seconds since Epoch

0
Hello, I’m trying to create a parameter I'm trying to make a microflow with a RESTcall to an API and I have created a parameter which is supposed to be filled with a string that th number of seconds for the past 24 hours since Epoch. I'm trying to make a location for a REST call microflow, but I'm stuck with creating thiS parameter. I would like to have some help to solve this problem. Any help is greatly ppreciated, thank you!   Edit: Thank you, the given answer worked well. I don’t know how I can mark your answer as ‘accepted’ on this forum, or give you kudos (or the equivalent on this forum).
asked
1 answers
3

There are several steps to this. 

  1. Create a new DateTime variable to represent 24 hours ago using something like this: addHours([%CurrentDateTime%], -24)
  2. Pass this value to “Datetime to Long” in the Community Commons library in the App Store. This returns the milliseconds since epoch for a datetime.
  3. As you need seconds, you need to create another variable to divide this by 1000 to get the number of seconds. As you need this as an integer/long, run it through floor() something like this: floor($vMilliseconds div 1000)
  4. Finally convert this to a string using toString()

 

Hope this helps

answered