Splunk Dev

Add-on builder: how to convert unix timestamp into UTC for a checkpoint and how to use Date.now()

TKelly
Explorer

So I'm trying to setup REST API calls with Add-on Builder and it requires two params: 'fromDate' and 'toDate'. So I ran into 2 problems:

1)  'toDate' in my case is time/date now (at the moment of API call). Is it possible to set up this param to something like Date.now() in JavaScript? 

2) 'fromDate' should be a checkpoint taken from the last record in the last response. The problem is that in the response this timestamp is in UNIX format. And for request, it should be UTC %d/%m/%y%H%M. How can I convert UNIX into UTC? + can I add an additional second to this extracted timestamp so my data won't overlap? 

Labels (3)
0 Karma
Get Updates on the Splunk Community!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...