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

Best Answer

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    @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 Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**

Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    @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 Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**