# Python date and time libraries

Python date libraries parse, convert, and calculate dates and times beyond what the standard datetime module covers. These libraries read the dates in logs, forms, and data files and convert them between time zones for reports and schedules.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [python-dateutil](#python-dateutil) | 1.2B | 2.6K | Nov 2026 | BSD-3-Clause |
| [pytz](#pytz) | 508.9M | 399 | Oct 2026 | MIT |
| [tzlocal](#tzlocal) | 192.0M | 221 | Oct 2026 | MIT |
| [Arrow](#arrow) | 73.7M | 9.1K | Oct 2025 | Apache-2.0 |
| [Pendulum](#pendulum) | 58.3M | 6.7K | Oct 2026 | MIT |
| [dateparser](#dateparser) | 44.1M | 2.9K | Nov 2026 | BSD-3-Clause |
| [holidays](#holidays) | 32.7M | 2.0K | Nov 2026 | MIT |
| [parsedatetime](#parsedatetime) | 25.7M | 710 | May 2020 | Apache-2.0 |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[python-dateutil](#python-dateutil) has the most installs, while [Arrow](#arrow) has the most GitHub stars.

## Capabilities

| Library | IANA timezone objects | Calendar month/year offsets | Relative date phrases |
| --- | --- | --- | --- |
| [python-dateutil](#python-dateutil) | Yes | Yes | Undocumented |
| [pytz](#pytz) | Yes | No | No |
| [tzlocal](#tzlocal) | Yes | No | No |
| [Arrow](#arrow) | Yes | Yes | Yes |
| [Pendulum](#pendulum) | Yes | Yes | Undocumented |
| [dateparser](#dateparser) | Yes | Yes | Yes |
| [holidays](#holidays) | No | No | Undocumented |
| [parsedatetime](#parsedatetime) | Via plugin | Yes | Yes |

## Libraries

### python-dateutil

[GitHub](https://github.com/dateutil/dateutil) · [PyPI](https://pypi.org/project/python-dateutil) · [Docs](https://dateutil.readthedocs.io/en/stable/parser.html)

python-dateutil extends Python's standard `datetime` module. The package installs as `python-dateutil` and imports as `dateutil`. `parser.parse` reads a date string in almost any format and returns a `datetime`. Calendar math comes from `relativedelta`, which adds units such as next month or the last week of a month. For repeating dates, `rrule` follows a superset of the iCalendar recurrence rules.

- Downloads / mo: 1.2B
- Stars: 2.6K
- Last release: 4.0.0
- License: BSD-3-Clause
- Capabilities: [From the python-dateutil docs](https://dateutil.readthedocs.io/en/stable/parser.html)

**Strengths**

- **Month and year offsets.** Add or subtract calendar months and years with relativedelta.
- **Recurring dates.** Build schedules by frequency, weekday, and day of the month with rrule.

**Watch out for**

- **Guesses on ambiguous dates.** Set dayfirst or yearfirst so numeric dates parse in the expected order.
- **Skips invalid recurrence dates.** A monthly rule on a day that some months lack skips those months.

```sh
pip install python-dateutil
```

**apache/superset** (75.6K stars)

[apache/superset](https://github.com/apache/superset) 

```python
def eval(self) -> datetime:
        dttm_expression, unit = self.value
        dttm = dttm_expression.eval()
        if unit == "year":
            return dttm.replace(
                month=12, day=31, hour=0, minute=0, second=0, microsecond=0
            )
        if unit == "quarter":
            # Both arguments are passed to a single `replace` so the day is
            # never briefly out of range for the new month (e.g. the 31st
            # moving into a 30-day quarter-end month).
            last_month = 3 * ((dttm.month - 1) // 3) + 3
            return dttm.replace(
                month=last_month,
                day=calendar.monthrange(dttm.year, last_month)[1],
                hour=0,
                minute=0,
                second=0,
                microsecond=0,
            )
        if unit == "month":
            return dttm.replace(
                day=calendar.monthrange(dttm.year, dttm.month)[1],
                hour=0,
                minute=0,
                second=0,
                microsecond=0,
            )
        if unit == "day":
            # The last day of a day is that same day. Truncating to midnight
            # keeps the result consistent with every other unit here, which
            # all return the final day at midnight rather than at its end.
            return dttm.replace(hour=0, minute=0, second=0, microsecond=0)
        # unit == "week":
        mon = dttm - relativedelta(days=dttm.weekday())
        mon = mon.replace(hour=0, minute=0, second=0, microsecond=0)
        return mon + relativedelta(days=6)

```

[superset/utils/date_parser.py](https://github.com/apache/superset/blob/32b4d6b54b996e6f6d8111f3aaa1227c2e1e9599/superset/utils/date_parser.py#L872-L908) · [More projects using python-dateutil →](https://dashboard.exa.ai/playground/search?q=Public%20Python%20projects%20using%20python-dateutil%20for%20date%20parsing%2C%20calendar%20offsets%2C%20timezone%20conversion%2C%20scheduling%20and%20localized%20relative%20dates&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from dateutil.parser import parse
parse("2003-09-25")

```

From [parser.html](https://dateutil.readthedocs.io/en/stable/parser.html)

### pytz

[GitHub](https://github.com/stub42/pytz) · [PyPI](https://pypi.org/project/pytz) · [Docs](https://github.com/stub42/pytz/blob/master/src/README.rst)

pytz brings the Olson time zone database into Python. `timezone('US/Eastern')` returns a zone object, and its `localize` method attaches that zone to a naive `datetime`. After arithmetic that crosses a daylight saving change, `normalize` corrects the offset. The README marks pytz as deprecated and points newer Python versions to the standard `zoneinfo` module, the type [tzlocal](#tzlocal) returns.

- Downloads / mo: 508.9M
- Stars: 399
- Last release: 2026.6
- License: MIT
- Capabilities: [From the pytz docs](https://github.com/stub42/pytz/blob/master/src/README.rst)

**Strengths**

- **Fixes DST arithmetic.** Call normalize() after arithmetic on local times that cross a daylight-saving change.

**Watch out for**

- **Deprecated by its maintainer.** On Python 3.9 or later, use the standard zoneinfo module in new code.
- **The tzinfo argument misbehaves.** Build local times with localize(), not the datetime tzinfo argument.

```sh
pip install pytz
```

**django/django** (91.9K stars)

[django/django](https://github.com/django/django) 

```python
def make_aware(value, timezone=None, is_dst=None):
    """Make a naive datetime.datetime in a given time zone aware."""
    if timezone is None:
        timezone = get_current_timezone()
    if _is_pytz_zone(timezone):
        # This method is available for pytz time zones.
        return timezone.localize(value, is_dst=is_dst)
    else:
        # Check that we won't overwrite the timezone of an aware datetime.
        if is_aware(value):
            raise ValueError(
                "make_aware expects a naive datetime, got %s" % value)
        # This may be wrong around DST changes!
        return value.replace(tzinfo=timezone)

```

[django/utils/timezone.py](https://github.com/django/django/blob/3591e1c1acbd7c13174275367c3fdf012cb0413b/django/utils/timezone.py#L236-L249) · [More projects using pytz →](https://dashboard.exa.ai/playground/search?q=pytz%20GitHub%20projects)

**Quickstart**

```python
from datetime import datetime
from pytz import timezone

eastern = timezone('US/Eastern')
loc_dt = eastern.localize(datetime(2002, 10, 27, 6, 0, 0))
print(loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'))

```

From [README.rst](https://github.com/stub42/pytz/blob/master/src/README.rst)

### tzlocal

[GitHub](https://github.com/regebro/tzlocal) · [PyPI](https://pypi.org/project/tzlocal) · [Docs](https://github.com/regebro/tzlocal/blob/master/README.rst)

tzlocal finds the machine's local time zone, which neither `pytz` nor `zoneinfo` can report on their own. `get_localzone` returns a `tzinfo` object even when the system has no zone name configured. A second function, `get_localzone_name`, returns only the name, such as `Europe/Paris`, when one is set. On Unix the library reads files such as `/etc/localtime` and `/etc/timezone`. Current versions return `zoneinfo` objects instead of [pytz](#pytz) objects.

- Downloads / mo: 192.0M
- Stars: 221
- Last release: 5.4.5
- License: MIT
- Capabilities: [From the tzlocal docs](https://github.com/regebro/tzlocal/blob/master/README.rst)

**Strengths**

- **Works without a zone name.** get_localzone() returns a timezone even when the system has no zone name configured.

**Watch out for**

- **Returns zoneinfo, not pytz.** Stay on version 4.0 for code that still needs pytz objects.
- **Docker setups often break.** Set the TZ environment variable in containers so tzlocal finds the right zone.

```sh
pip install tzlocal
```

**Azure/agent-app-ingestion** (187 stars)

[Azure/agent-app-ingestion](https://github.com/Azure/agent-app-ingestion) 

```python
def _resolve_timezone():
    tz_name = os.getenv("SCHEDULER_TIMEZONE")
    if tz_name:
        try:
            return ZoneInfo(tz_name)
        except (ZoneInfoNotFoundError, ValueError):
            logging.warning(f"Invalid SCHEDULER_TIMEZONE '{tz_name}', defaulting to machine timezone")
    return get_localzone()

```

[main.py](https://github.com/Azure/agent-app-ingestion/blob/9f4b06dd7e12fe1acfba6c5bdbde961de4613088/main.py#L63-L70) · [More projects using tzlocal →](https://dashboard.exa.ai/playground/search?q=tzlocal%20GitHub%20projects)

**Quickstart**

```python
from tzlocal import get_localzone
tz = get_localzone()

```

From [README.rst](https://github.com/regebro/tzlocal/blob/master/README.rst)

### Arrow

[GitHub](https://github.com/arrow-py/arrow) · [PyPI](https://pypi.org/project/arrow) · [Docs](https://arrow.readthedocs.io/en/latest/api-guide.html)

Arrow provides a drop-in replacement for Python's `datetime` that is timezone-aware and set to UTC by default. `arrow.get` parses ISO strings and timestamps, `shift` moves a value by hours, days, or weeks, and `to` converts it to another time zone. For display, `humanize` returns phrases such as "an hour ago" in many languages. The README credits moment.js, the JavaScript date library, as its inspiration.

- Downloads / mo: 73.7M
- Stars: 9.1K
- Last release: 1.4.0
- License: Apache-2.0
- Capabilities: [From the Arrow docs](https://arrow.readthedocs.io/en/latest/api-guide.html)

**Strengths**

- **Chains timezone conversions.** Parse a value, shift it by calendar units, and convert its timezone in one chain.
- **Humanizes in many locales.** Pass a locale to humanize() to get phrases like "an hour ago" in that language.

**Watch out for**

- **Shifts move nonexistent times.** Shifts into a daylight-saving gap move to a real time by default. Pass check_imaginary=False to skip that.

```sh
pip install -U arrow
```

**Koed00/django-q** (1.9K stars)

[Koed00/django-q](https://github.com/Koed00/django-q) 

```python
def scheduler(broker: Broker = None):
    """
    Creates a task from a schedule at the scheduled time and schedules next run
    """
    if not broker:
        broker = get_broker()
    close_old_django_connections()
    try:
        database_to_use = {"using": Conf.ORM} if not Conf.HAS_REPLICA else {}
        with db.transaction.atomic(**database_to_use):
            for s in (
                Schedule.objects.select_for_update()
                .exclude(repeats=0)
                .filter(next_run__lt=timezone.now())
                .filter(
                    db.models.Q(cluster__isnull=True) | db.models.Q(cluster=Conf.PREFIX)
                )
            ):
                args = ()
                kwargs = {}
                # get args, kwargs and hook
                if s.kwargs:
                    try:
                        # eval should be safe here because dict()
                        kwargs = eval(f"dict({s.kwargs})")
                    except SyntaxError:
                        kwargs = {}
                if s.args:
                    args = ast.literal_eval(s.args)
                    # single value won't eval to tuple, so:
                    if type(args) != tuple:
                        args = (args,)
                q_options = kwargs.get("q_options", {})
                if s.hook:
                    q_options["hook"] = s.hook
                # set up the next run time
                if s.schedule_type != s.ONCE:
                    next_run = arrow.get(s.next_run)
                    while True:
                        if s.schedule_type == s.MINUTES:
                            next_run = next_run.shift(minutes=+(s.minutes or 1))
                        elif s.schedule_type == s.HOURLY:
                            next_run = next_run.shift(hours=+1)
                        elif s.schedule_type == s.DAILY:
                            next_run = next_run.shift(days=+1)
                        elif s.schedule_type == s.WEEKLY:
                            next_run = next_run.shift(weeks=+1)
                        elif s.schedule_type == s.MONTHLY:
                            next_run = next_run.shift(months=+1)
                        elif s.schedule_type == s.QUARTERLY:
                            next_run = next_run.shift(months=+3)
                        elif s.schedule_type == s.YEARLY:
                            next_run = next_run.shift(years=+1)
                        elif s.schedule_type == s.CRON:
                            if not croniter:
                                raise ImportError(
                                    _(
                                        "Please install croniter to enable cron expressions"
                                    )
                                )
                            next_run = arrow.get(
                                croniter(s.cron, localtime()).get_next()
                            )
                        if Conf.CATCH_UP or next_run > arrow.utcnow():
                            break
                    # arrow always returns a tz aware datetime, and we don't want
                    # this when we explicitly configured django with USE_TZ=False
                    s.next_run = (
                        next_run.datetime
                        if settings.USE_TZ
                        else next_run.datetime.replace(tzinfo=None)
                    )
                    s.repeats += -1
                # send it to the cluster
                scheduled_broker = broker
                try:
                    scheduled_broker = get_broker(q_options["broker_name"])
                except:  # invalid broker_name or non existing broker with broker_name
                    pass
                q_options["broker"] = scheduled_broker
                q_options["group"] = q_options.get("group", s.name or s.id)
                kwargs["q_options"] = q_options
                s.task = django_q.tasks.async_task(s.func, *args, **kwargs)
                # log it
                if not s.task:
                    logger.error(
                        _(
                            f"{current_process().name} failed to create a task from schedule [{s.name or s.id}]"
                        )
                    )
                else:
                    logger.info(
                        _(
                            f"{current_process().name} created a task from schedule [{s.name or s.id}]"
                        )
                    )
                # default behavior is to delete a ONCE schedule
                if s.schedule_type == s.ONCE:
                    if s.repeats < 0:
                        s.delete()
                        continue
                    # but not if it has a positive repeats
                    s.repeats = 0
                # save the schedule
                s.save()
    except Exception as e:
        logger.error(e)

```

[django_q/cluster.py](https://github.com/Koed00/django-q/blob/85baaccd2c3adfe0a414d4237465163e9ff6e5a0/django_q/cluster.py#L578-L684) · [More projects using Arrow →](https://dashboard.exa.ai/playground/search?q=Public%20Python%20projects%20using%20arrow%20for%20date%20parsing%2C%20calendar%20offsets%2C%20timezone%20conversion%2C%20scheduling%20and%20localized%20relative%20dates&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import arrow
arrow.get('2013-05-11T21:23:58.970460+07:00')

```

From [README.rst](https://github.com/arrow-py/arrow/blob/master/README.rst)

### Pendulum

[GitHub](https://github.com/python-pendulum/pendulum) · [PyPI](https://pypi.org/project/pendulum) · [Docs](https://pendulum.eustace.io/docs/)

Pendulum's `DateTime` class inherits from Python's `datetime`, so it works where a `datetime` is expected. Every instance is timezone-aware and in UTC by default. `in_timezone` converts a value to another zone, `add` and `subtract` move it by calendar units, and `diff_for_humans` describes the gap from now, such as "two minutes ago". Arithmetic across a daylight saving change returns a time that exists on the clock. [Arrow](#arrow) covers the same ground with its own type, while Pendulum stays a subclass of `datetime`.

- Downloads / mo: 58.3M
- Stars: 6.7K
- Last release: 3.3.0
- License: MIT
- Capabilities: [From the Pendulum docs](https://pendulum.eustace.io/docs/)

**Strengths**

- **Converts timezones in one call.** Call in_timezone() to move a date into another timezone.
- **Localized relative times.** Pass locale to diff_for_humans() to change the language for one call.

**Watch out for**

- **Strict parsing by default.** Pass strict=False to fall back to the dateutil parser for other formats.
- **Some drivers check the type.** Database drivers such as `PyMySQL` and `mysqlclient` check an object's exact type, so they need an adapter registered for `DateTime`.

```sh
pip install pendulum
```

**apache/airflow** (47.5K stars)

[apache/airflow](https://github.com/apache/airflow) 

```python
def parse_timezone(name: str | int) -> FixedTimezone | Timezone:
    """
    Parse timezone and return one of the pendulum Timezone.

    Provide the same interface as ``pendulum.timezone(name)``

    :param name: Either IANA timezone or offset to UTC in seconds.

    :meta private:
    """
    if _PENDULUM3:
        # This only presented in pendulum 3 and code do not reached into the pendulum 2
        return pendulum.timezone(name)  # type: ignore[operator]
    # In pendulum 2 this refers to the function, in pendulum 3 refers to the module
    return pendulum.tz.timezone(name)  # type: ignore[operator]

```

[shared/timezones/src/airflow_shared/timezones/timezone.py](https://github.com/apache/airflow/blob/2dae3e4e161636ffb00f8c49c018b7ecf337831e/shared/timezones/src/airflow_shared/timezones/timezone.py#L275-L289) · [More projects using Pendulum →](https://dashboard.exa.ai/playground/search?q=Public%20Python%20projects%20using%20pendulum%20for%20date%20parsing%2C%20calendar%20offsets%2C%20timezone%20conversion%2C%20scheduling%20and%20localized%20relative%20dates&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import pendulum
pendulum.datetime(2015, 2, 5, tz='Europe/Paris')

```

From [the Pendulum docs](https://pendulum.eustace.io/docs/)

### dateparser

[GitHub](https://github.com/scrapinghub/dateparser) · [PyPI](https://pypi.org/project/dateparser) · [Docs](https://dateparser.readthedocs.io/en/latest/)

dateparser turns human-readable date strings into `datetime` objects through one function, `dateparser.parse`. Absolute dates, relative phrases such as "two weeks ago", and timestamps all parse, in more than two hundred language locales. The language is detected automatically unless `languages` sets it. Formats passed in `date_formats` are tried before the general parser. Compared with [parsedatetime](#parsedatetime), dateparser returns a `datetime` directly instead of a time tuple.

- Downloads / mo: 44.1M
- Stars: 2.9K
- Last release: 1.5.0
- License: BSD-3-Clause
- Capabilities: [From the dateparser docs](https://dateparser.readthedocs.io/en/latest/)

**Strengths**

- **Parses many languages.** Pass languages when they are known, and dateparser skips detection.
- **Parses relative dates.** Turns phrases like "In two months" into a datetime.

**Watch out for**

- **Fills in missing date parts.** Set STRICT_PARSING to reject dates with missing parts.

```sh
pip install dateparser
```

**the-paperless-project/paperless** (7.9K stars)

[the-paperless-project/paperless](https://github.com/the-paperless-project/paperless) 

```python
def __parser(ds, date_order):
            """
            Call dateparser.parse with a particular date ordering
            """
            return dateparser.parse(
                ds,
                settings={
                    "DATE_ORDER": date_order,
                    "PREFER_DAY_OF_MONTH": "first",
                    "RETURN_AS_TIMEZONE_AWARE":
                    True
                }
            )

```

[src/documents/parsers.py](https://github.com/the-paperless-project/paperless/blob/9b0063c9731f7c5f65b1852cb8caff97f5e40ba4/src/documents/parsers.py#L79-L91) · [More projects using dateparser →](https://dashboard.exa.ai/playground/search?q=Public%20Python%20projects%20using%20dateparser%20for%20date%20parsing%2C%20calendar%20offsets%2C%20timezone%20conversion%2C%20scheduling%20and%20localized%20relative%20dates&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import dateparser
dateparser.parse('1991-05-17')

```

From [README.rst](https://github.com/scrapinghub/dateparser/blob/master/README.rst)

### holidays

[GitHub](https://github.com/vacanza/holidays) · [PyPI](https://pypi.org/project/holidays) · [Docs](https://holidays.readthedocs.io/en/latest/api/)

holidays generates the public holidays of a country, or of a subdivision such as a state or province, as a dict-like object. `holidays.country_holidays("US")` returns the calendar. Testing a `date`, a date string, or a timestamp with `in` says whether that day is a holiday, while `get` returns the holiday's name. Calendars cover more than two hundred country codes. For markets, `financial_holidays("NYSE")` returns stock exchange closing days.

- Downloads / mo: 32.7M
- Stars: 2.0K
- Last release: 0.109
- License: MIT
- Capabilities: [From the holidays docs](https://holidays.readthedocs.io/en/latest/api/)

**Strengths**

- **Stock exchange calendars.** Call financial_holidays("NYSE") to get trading holidays for an exchange.
- **Names in other languages.** Pass language to get holiday names in the language users read.

**Watch out for**

- **Observed days included by default.** Set observed=False to get only the official dates, and test it for the country in question.

```sh
pip install --upgrade holidays
```

**meta/prophet** (20.5K stars)

[meta/prophet](https://github.com/meta/prophet) 

```python
def make_holidays_df(
    year_list: list[int],
    country: str,
    province: str | None = None,
    state: str | None = None,  # unused
) -> pd.DataFrame:
    """Make dataframe of holidays for given years and countries

    Parameters
    ----------
    year_list: a list of years
    country: country name
    province: province name

    Returns
    -------
    Dataframe with 'ds' and 'holiday', which can directly feed
    to 'holidays' params in Prophet
    """
    country_holidays = get_country_holidays_class(country)
    holidays = country_holidays(expand=False, language="en_US", subdiv=province, years=year_list)

    holidays_df = pd.DataFrame(
        [(date, holidays.get_list(date)) for date in holidays],
        columns=["ds", "holiday"],
    )
    holidays_df = holidays_df.explode("holiday")
    holidays_df.reset_index(inplace=True, drop=True)
    holidays_df["ds"] = pd.to_datetime(holidays_df["ds"])

    return holidays_df

```

[python/prophet/make_holidays.py](https://github.com/meta/prophet/blob/5cf15c0f6e5d5259d9dd8d511fb4e15a45884cdc/python/prophet/make_holidays.py#L51-L81) · [More projects using holidays →](https://dashboard.exa.ai/playground/search?q=holidays%20GitHub%20projects)

**Quickstart**

```python
from datetime import date
import holidays
us_holidays = holidays.US()  # this is a dict-like object
date(2015, 1, 1) in us_holidays  # True

```

From [README.md](https://github.com/vacanza/holidays/blob/dev/README.md)

### parsedatetime

[GitHub](https://github.com/bear/parsedatetime) · [PyPI](https://pypi.org/project/parsedatetime) · [Docs](https://github.com/bear/parsedatetime/blob/master/README.md)

parsedatetime parses human-readable date and time text, such as "tomorrow", with a `Calendar` object. `Calendar.parse` returns a time tuple and a status code, and the tuple needs one more step to become a `datetime`. For a timezone-aware result, `parseDT` takes a [pytz](#pytz) zone and returns a `datetime` directly.

- Downloads / mo: 25.7M
- Stars: 710
- Last release: 2.6
- License: Apache-2.0
- Capabilities: [From the parsedatetime docs](https://github.com/bear/parsedatetime/blob/master/README.md)

**Strengths**

- **Parses everyday phrases.** Create a Calendar and call parse() on text such as "tomorrow".

**Watch out for**

- **Returns a time tuple.** parse() returns a time tuple and a status, so convert it before using it as a datetime.
- **Timezones come from pytz.** Pass a pytz timezone to parseDT() to get a timezone-aware result.

```sh
pip install parsedatetime
```

**apache/superset** (75.6K stars)

[apache/superset](https://github.com/apache/superset) 

```python
def parse_human_datetime(human_readable: str) -> datetime:
    """Returns ``datetime.datetime`` from human readable strings"""
    x_periods = r"^\s*([0-9]+)\s+(second|minute|hour|day|week|month|quarter|year)s?\s*$"
    if re.search(x_periods, human_readable, re.IGNORECASE):
        raise TimeRangeAmbiguousError(human_readable)
    try:
        default = datetime(year=datetime.now().year, month=1, day=1)
        dttm = parse(human_readable, default=default)
    except (ValueError, OverflowError) as ex:
        cal = parsedatetime.Calendar()
        parsed_dttm, parsed_flags = cal.parseDT(human_readable)
        # 0 == not parsed at all
        if parsed_flags == 0:
            logger.debug(ex)
            raise TimeRangeParseFailError(human_readable) from ex
        # when time is not extracted, we 'reset to midnight'
        if parsed_flags & 2 == 0:
            parsed_dttm = parsed_dttm.replace(hour=0, minute=0, second=0)
        dttm = dttm_from_timetuple(parsed_dttm.utctimetuple())
    return dttm

```

[superset/utils/date_parser.py](https://github.com/apache/superset/blob/32b4d6b54b996e6f6d8111f3aaa1227c2e1e9599/superset/utils/date_parser.py#L93-L112) · [More projects using parsedatetime →](https://dashboard.exa.ai/playground/search?q=parsedatetime%20GitHub%20projects)

**Quickstart**

```python
import parsedatetime
cal = parsedatetime.Calendar()
cal.parse("tomorrow")

```

From [README.md](https://github.com/bear/parsedatetime/blob/master/README.md)

## FAQ

### Which Python date library should I use?

Start with the standard datetime and zoneinfo modules, and add [python-dateutil](#python-dateutil), with 1.2B downloads a month, for parsing and month math. Choose [Arrow](#arrow) or [Pendulum](#pendulum) for a friendlier API, or [dateparser](#dateparser) for dates written in other languages.

### What does python-dateutil add to datetime?

It adds a forgiving string parser, `relativedelta` for month and year offsets, `rrule` for recurring dates, and extra timezone helpers. It works on standard datetime objects instead of replacing them.

### How do I add months to a date in Python?

Add `relativedelta(months=n)` from python-dateutil to the date. When the target month is shorter, the result lands on the last day of that month. A plain `timedelta` counts days, so it can't add calendar months.

### How do I parse a date from a string in Python?

Use `datetime.strptime` when the exact format is known. Use `dateutil.parser.parse` for most other formats, and [dateparser](#dateparser) for relative phrases such as "two weeks ago" or dates in other languages.

### pytz vs zoneinfo: which should I use?

Use zoneinfo. The pytz maintainer marks pytz as deprecated and points modern Python projects to the standard zoneinfo module. Keep pytz only for older code that depends on its `localize()` API.

### How do I check if a date is a holiday in Python?

Use [holidays](#holidays). Build a calendar with `holidays.country_holidays("US")` and test a date with `in`. Call `holidays.financial_holidays("NYSE")` for stock exchange holidays.

## How this page was built

Data checked Nov 18, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python date datetime libraries datetime python-dateutil Pendulum Arrow dateparser code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
