How to fetch tweets since last three months by a user using twitter API

twitter

Solution

The twitter api has the search call method. You're already using `since_id` for the ids, but it looks like you want to use dates as well.

The two date methods (year-month-day) are:

- `hashtag since:1988-06-28` - Searches for "hashtag" and sent since date "1988-06-28".

- `hashtag until:2013-07-12` - Searches for "hashtag" and sent before date "2013-07-12".

Those two date examples (apart from the actual dates) are plucked straight from the documentation. If you want the last three months, just:

- Calculate three months past to the following format: YYYY-MM-DD.

- Use that in the since query

As of today, three months past is: 2013-04-12

`since: 2013-04-12` - would be what you require in your `GET` request. Documentation Link.

Problem

You can use `since_id` & `max_id` to fetch tweets between a specific ID. I want to know how to fetch tweets posted within the last three months, but I don't know how to find the tweet ID, which was posted before three months.

Original source