Unix Timestamp or epoch time in connector

Reply
Highlighted
Orange Belt

Unix Timestamp or epoch time in connector

Hi,

 

I am trying to build a new connector where I need to add the unix_timestamp into the header.

 

How do I get the epoch/unix timestamp?

 

This is A string that contains the a long value that represents the current time in milliseconds since midnight, January 1, 1970 UTC.

 

Thanks


Accepted Solutions
Highlighted
Brown Belt

Re: Unix Timestamp or epoch time in connector

@Simon_King 

 

Assuming you're doing this in JavaScript you can utilize the getTime function:

 

var ts = Math.round((new Date()).getTime() / 1000);

 

The above example uses the current timestamp but you can swap out the new Date() call with a different date if necessary.



**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**

View solution in original post


All Replies
Highlighted
Brown Belt

Re: Unix Timestamp or epoch time in connector

@Simon_King 

 

Assuming you're doing this in JavaScript you can utilize the getTime function:

 

var ts = Math.round((new Date()).getTime() / 1000);

 

The above example uses the current timestamp but you can swap out the new Date() call with a different date if necessary.



**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**

View solution in original post

Announcements
Stand out in the Dojo: Choose your own recognizable username and add a unique profile photo in your profile settings.