How to get Twitter current time?


Hi guys, I need to get twitter current time to compare with a tweet ‘created_at’ time and I don’t know how to do that. Here in the discussion I saw something about read from the ‘date’ header from an api call but, I can’t find when I print a dir(api_call). Is it need to be a specific call? I don’t have experience in the area so what I tried was:

eu =
print dir(eu.status)
print dir(api)

There was no date header there.

Can someone, please, tell me which call should have a Date header?

ps: I’m using tweepy api.

Thanks a lot.


Att: Now I know how to make the request and get the ‘Date’ with:

import requests r = requests.get("") twitter_time = r.headers.pop('date')

And it’s working, but I obtain a string like:
Sun, 20 Oct 2013 07:03:52 UTC

And in order to make comparisons I need to get the numbers individually or in Unix time.
I know I could make some string manipulation but I’m pretty sure that there is some easier way to do that.

Can anyone help me out?


I think in Python you’ll want to parse the date using dateutil’s parser to get a date time object, then convert that date time to an epoch using .strftime(’%s’) or a more dedicated method.