Amel Jose
Amel Jose

Reputation: 883

can anyone provide me with Java code to generate timestamp to be used in OAuth requests?

The OAuth Spec says that the timestamp is expressed in the number of seconds since January 1, 1970 00:00:00 GMT. The timestamp value MUST be a positive integer and MUST be equal or greater than the timestamp used in previous requests.

I need it to us it my Android App to make an http post

Upvotes: 0

Views: 1073

Answers (3)

DP Greveling
DP Greveling

Reputation: 409

You could use:

int authSeconds = (int)(new Date().getTime()/1000);

Upvotes: 0

Boe-Dev
Boe-Dev

Reputation: 1595

for the current time stamp use System.currentTimeMillis()/1000

Upvotes: 4

thepoosh
thepoosh

Reputation: 12587

try this:

int authSeconds = (int)(new Date().getTime()/1000);

Upvotes: 1

Related Questions