NetTalk Central

Author Topic: How to get javascript date or epoch date for oAuth timestamp  (Read 5322 times)

debzidoodle

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
    • Email
How to get javascript date or epoch date for oAuth timestamp
« 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?


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to get javascript date or epoch date for oAuth timestamp
« Reply #1 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

debzidoodle

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
    • Email
Re: How to get javascript date or epoch date for oAuth timestamp
« Reply #2 on: April 22, 2014, 04:31:46 AM »
Thats great!  You are the man!!!  Thank you   :D