Reputation: 816
I am trying to work out how to calculate the number of minutes between two separate tweets and use it within jQuery code. Does anyone who has any knowledge of the Twitter API know how to do this?
Upvotes: 0
Views: 99
Reputation: 1001
If you call the Twitter-API you get the created_at
field (tried JSON) something like this Wed, 20 Apr 2011 09:36:39 +0000
.
With Javascript you can put that in a Date
Object:
foo = new Date('Wed, 20 Apr 2011 09:36:39 +0000')
You can get the UNIX Timestamp with foo.getTime()
in milliseconds 1303292199000
With some simple math you can now calculate the time between two tweets...
Simple...for that part you don't need jQuery.
Upvotes: 2