NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: debzidoodle on April 21, 2014, 05:16:16 PM

Title: How to get javascript date or epoch date for oAuth timestamp
Post by: debzidoodle on April 21, 2014, 05:16:16 PM
Hello,

I am trying to setup an oAuth Request Token procedure.   It is v1 so it requires the unix\epoch time, which is the same thing as the javascript code like this
Code: [Select]
var epochTime = (new Date).getTime()
Does NT have a way for me to get this value from server side code?

Title: Re: How to get javascript date or epoch date for oAuth timestamp
Post by: Bruce on April 21, 2014, 10:54:12 PM
Hi Debra,

There are 3 methods to convert to and from Unix Epoch dates.

p_web.ClarionToUnixDate (date,time)

so the epoch date of the current date/time on the server is

p_web.ClarionToUnixDate (today(),clock())

Returns a long in "unix epoch" format. Pretty much works for dates from 1970 to 2038.

The reverse are;

p_web.UnixToClarionDate(epoch)
and
p_web.UnixToClarionTime(epoch)

Cheers
Bruce
Title: Re: How to get javascript date or epoch date for oAuth timestamp
Post by: debzidoodle on April 22, 2014, 04:31:46 AM
Thats great!  You are the man!!!  Thank you   :D