08-04-2022 06:39 PM
Hello,
I'm trying to use the Cisco Developer API but in order to do so I want the current epoch time and the epoch time 24 hours ago - to be used in the to and from in my GraphQL query. I was wondering if it was possible to do this in the set variable block using Pebble syntax. Or even possible to do directly in the Curl request as Date.now() or something similar? Any advice would be great!
Thanks,
Donny Miller
Solved! Go to Solution.
01-18-2023 07:21 AM
Hi Team,
This was fixed - this is the way of getting the epoch timestamp in flow.
{{ now() | epoch }} => default UTC timezone and in seconds
{{ now() | epoch(inMillis=true) }} => default UTC timezone and in milliseconds
{{ '2017-10-19 16:18:03.779' | epoch(format='yyyy-MM-dd HH:mm:ss.SSS', inMillis=true) }} => custom format and in milliseconds
{{ '2017-10-19 16:18:03.779' | epoch(format='yyyy-MM-dd HH:mm:ss.SSS', inMillis=true, timeZone='America/Phoenix') }} => custom format with timezone and in milliseconds
Thanks & Regards,
Arunabh.
08-05-2022 02:27 PM
Hi Donny,
This does not exist today, we've opened up an enhancement internally to get it added. The pebble engine uses the SimpleDateFormatter class but does not use a getTime() method to allow for Date --> Epoch
So it is likely that we will introduce another method, just like {{ now() }} that exists purely in Flow Engine to allow for both, epoch.now() and epoch.from(< Date Time String> )
For now however, you can use an external API such as :
https://worldtimeapi.org/api/timezone/America/Chicago
to get the epoch timestamp and then * 1000 for millis
Thanks & Regards,
Arunabh.
01-18-2023 07:21 AM
Hi Team,
This was fixed - this is the way of getting the epoch timestamp in flow.
{{ now() | epoch }} => default UTC timezone and in seconds
{{ now() | epoch(inMillis=true) }} => default UTC timezone and in milliseconds
{{ '2017-10-19 16:18:03.779' | epoch(format='yyyy-MM-dd HH:mm:ss.SSS', inMillis=true) }} => custom format and in milliseconds
{{ '2017-10-19 16:18:03.779' | epoch(format='yyyy-MM-dd HH:mm:ss.SSS', inMillis=true, timeZone='America/Phoenix') }} => custom format with timezone and in milliseconds
Thanks & Regards,
Arunabh.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide