Is there an equivalent in javascript to the .net code below to get seconds since 1/1/1970?
DateDiff(DateInterval.Second, #1/1/1970#, DateTime.Now.ToUniversalTime)
As a JavaScript date is the milliseconds since 1/1/1970, you just divide by 1000.
var seconds = Date.now() / 1000;
The getTime() function of the JavaScript Date() returns the milliseconds since 1/1/1970. The standard docs cover the details.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime
Divide by 1,000 to convert millisecond to seconds.
var ms = new Date().getTime(); var secs = ms/1000; console.log(secs);
But does that return Universal time?
Ignore as it looks like it does.