Search code examples
javatwitter4j

Does twitter4j provide the capability to search tweets between 2 dates


Does twitter4j provide the capability to search tweets between 2 dates (e.g. 2011-10-27 05:30:00 to 2011-10-27 06:30:00)

currently it seems to have the granularity of a date and not hours or minutes.


Solution

  • No, at the current version there is no way to specify date & time for searching within given range.

    And that's the limitation of Twitter search API:

    Notes about Search Operators

    since and until

    • do not support the negation (-) operator.
    • List item should be entered in the format year-month-day or yyyy-mm-dd.
    • are assumed to be from/to 00:00 UTC.
    • cannot be set into the future. If until is in the future you will receive an HTTP 403 error with the message: {"error":"You cannot use an 'until:' date in the future"}. If since is in the future you will receive an HTTP 403 error with the message: {"error":"since_id too recent, poll less frequently"}