# `faker.providers.date_time`

class faker.providers.date_time.Provider(generator: Any)

  Bases: `BaseProvider`

  Most methods of the provider accept a ‘start_datetime’ and/or ‘end_datetime’ parameter.

  These parameters accept a variety of types, and are used to define the range of the random date/time.

  We call this type `DateParseType`.

  A `DateParseType` can be:

  - a datetime or date object

  - an integer or a float, representing UNIX a timestamp

  - the special string ‘now’

  - the special string ‘today’

  - a timedelta object, representing a time delta from now

  - a ‘timedelta string’, such as ‘+2d’, ‘-3w’, ‘+4y’, etc. Representing a time delta from now.

  am_pm() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.am_pm()
        ...
        'AM'
        'AM'
        'PM'
        'AM'
        'AM'

  century() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.century()
        ...
        'XIII'
        'XIV'
        'II'
        'IX'
        'XVII'

  date(pattern: str = '%Y-%m-%d', end_datetime: date | datetime | timedelta | str | int | None = None) → str

    Get a date string between January 1, 1970 and now.

    Parameters:

      - pattern – Format of the date (year-month-day by default)

      - end_datetime – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date()
        ...
        '2017-04-10'
        '2012-06-07'
        '1993-07-18'
        '1984-06-30'
        '1998-08-16'

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date(pattern='%m/%d/%Y')
        ...
        '04/10/2017'
        '06/07/2012'
        '07/18/1993'
        '06/30/1984'
        '08/16/1998'

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date(end_datetime='+1w')
        ...
        '2017-04-15'
        '2012-06-12'
        '1993-07-21'
        '1984-07-01'
        '1998-08-19'

  date_between(start_date: date | datetime | timedelta | str | int = '-30y', end_date: date | datetime | timedelta | str | int = 'today') → date

    Get a Date object based on a random date between two given dates. Accepts date strings that can be recognized by strtotime().

    Parameters:

      - start_date – A `DateParseType`. Defaults to 30 years ago

      - end_date – A `DateParseType`. Defaults to `"today"`

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_between()
        ...
        datetime.date(2021, 4, 25)
        datetime.date(2018, 9, 20)
        datetime.date(2008, 8, 6)
        datetime.date(2003, 10, 1)
        datetime.date(2011, 4, 27)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_between(start_date='-1w')
        ...
        datetime.date(2025, 12, 23)
        datetime.date(2025, 12, 23)
        datetime.date(2025, 12, 20)
        datetime.date(2025, 12, 19)
        datetime.date(2025, 12, 21)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_between(start_date="-1y", end_date="+1w")
        ...
        datetime.date(2025, 11, 3)
        datetime.date(2025, 10, 2)
        datetime.date(2025, 5, 29)
        datetime.date(2025, 3, 30)
        datetime.date(2025, 7, 2)

  date_between_dates(date_start: date | datetime | timedelta | str | int | None = None, date_end: date | datetime | timedelta | str | int | None = None) → date

    Get a random date between the two given dates.

    Parameters:

      - date_start – A `DateParseType`. Defaults to the UNIX epoch

      - date_end – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_between_dates()
        ...
        datetime.date(2025, 12, 25)
        datetime.date(2025, 12, 25)
        datetime.date(2025, 12, 25)
        datetime.date(2025, 12, 25)
        datetime.date(2025, 12, 25)

  date_object(end_datetime: datetime | None = None) → date

    Get a date object between January 1, 1970 and now

    Parameters:

      end_datetime – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_object()
        ...
        datetime.date(2017, 4, 10)
        datetime.date(2012, 6, 7)
        datetime.date(1993, 7, 18)
        datetime.date(1984, 6, 30)
        datetime.date(1998, 8, 16)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_object(end_datetime='+1w')
        ...
        datetime.date(2017, 4, 15)
        datetime.date(2012, 6, 12)
        datetime.date(1993, 7, 21)
        datetime.date(1984, 7, 1)
        datetime.date(1998, 8, 19)

  date_of_birth(tzinfo: tzinfo | None = None, minimum_age: int = 0, maximum_age: int = 115) → date

    Generate a random date of birth represented as a Date object, constrained by optional miminimum_age and maximum_age parameters.

    Parameters:

      - tzinfo – Defaults to None.

      - minimum_age – Defaults to `0`.

      - maximum_age – Defaults to `115`.

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_of_birth()
        ...
        datetime.date(2007, 12, 8)
        datetime.date(1997, 11, 26)
        datetime.date(1958, 10, 8)
        datetime.date(1940, 1, 7)
        datetime.date(1969, 4, 16)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_of_birth(minimum_age=30, maximum_age=50)
        ...
        datetime.date(1992, 9, 17)
        datetime.date(1990, 11, 24)
        datetime.date(1983, 10, 24)
        datetime.date(1980, 6, 1)
        datetime.date(1985, 9, 19)

  date_this_century(before_today: bool = True, after_today: bool = False) → date

    Gets a Date object for the current century.

    Parameters:

      - before_today – include days in current century before today. Defaults to True

      - after_today – include days in current century after today. Defaults to False

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_century()
        ...
        datetime.date(2021, 12, 9)
        datetime.date(2019, 9, 10)
        datetime.date(2010, 12, 5)
        datetime.date(2006, 9, 23)
        datetime.date(2013, 4, 13)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_century(before_today=False, after_today=True)
        ...
        datetime.date(2088, 6, 25)
        datetime.date(2082, 1, 31)
        datetime.date(2057, 2, 10)
        datetime.date(2045, 2, 22)
        datetime.date(2063, 10, 29)

  date_this_decade(before_today: bool = True, after_today: bool = False) → date

    Gets a Date object for the decade year.

    Parameters:

      - before_today – include days in current decade before today. Defaults to True

      - after_today – include days in current decade after today. Defaults to False

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_decade()
        ...
        datetime.date(2025, 1, 19)
        datetime.date(2024, 7, 14)
        datetime.date(2022, 7, 7)
        datetime.date(2021, 7, 19)
        datetime.date(2023, 1, 22)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_decade(before_today=False, after_today=True)
        ...
        datetime.date(2029, 5, 17)
        datetime.date(2029, 1, 10)
        datetime.date(2027, 9, 3)
        datetime.date(2027, 1, 9)
        datetime.date(2028, 1, 14)

  date_this_month(before_today: bool = True, after_today: bool = False) → date

    Gets a Date object for the current month.

    Parameters:

      - before_today – include days in current month before today. Defaults to True

      - after_today – include days in current month after today. Defaults to False

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_month()
        ...
        datetime.date(2025, 12, 21)
        datetime.date(2025, 12, 19)
        datetime.date(2025, 12, 11)
        datetime.date(2025, 12, 7)
        datetime.date(2025, 12, 13)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_month(before_today=False, after_today=True)
        ...
        datetime.date(2025, 12, 30)
        datetime.date(2025, 12, 30)
        datetime.date(2025, 12, 27)
        datetime.date(2025, 12, 26)
        datetime.date(2025, 12, 28)

  date_this_year(before_today: bool = True, after_today: bool = False) → date

    Gets a Date object for the current year.

    Parameters:

      - before_today – include days in current year before today. Defaults to True

      - after_today – include days in current year after today. Defaults to False

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_year()
        ...
        datetime.date(2025, 10, 30)
        datetime.date(2025, 9, 29)
        datetime.date(2025, 5, 31)
        datetime.date(2025, 4, 3)
        datetime.date(2025, 7, 3)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_this_year(before_today=False, after_today=True)
        ...
        datetime.date(2025, 12, 30)
        datetime.date(2025, 12, 30)
        datetime.date(2025, 12, 27)
        datetime.date(2025, 12, 26)
        datetime.date(2025, 12, 28)

  date_time(tzinfo: tzinfo | None = None, end_datetime: date | datetime | timedelta | str | int | None = None) → datetime

    Get a datetime object for a date between January 1, 1970 and a specified end_datetime

    Parameters:

      - tzinfo – timezone, instance of datetime.tzinfo subclass

      - end_datetime – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time()
        ...
        datetime.datetime(2017, 4, 10, 2, 4, 20, 566417)
        datetime.datetime(2012, 6, 7, 1, 36, 2, 62654)
        datetime.datetime(1993, 7, 18, 12, 33, 17, 97369)
        datetime.datetime(1984, 6, 30, 3, 7, 2, 892104)
        datetime.datetime(1998, 8, 16, 3, 37, 20, 644043)

  date_time_ad(tzinfo: tzinfo | None = None, end_datetime: date | datetime | timedelta | str | int | None = None, start_datetime: date | datetime | timedelta | str | int | None = None) → datetime

    Get a datetime object for a date between January 1, 0001 and now

    Parameters:

      - tzinfo – timezone, instance of datetime.tzinfo subclass

      - end_datetime – A `DateParseType`. Defaults to the current date and time

      - start_datetime – A `DateParseType`. Defaults to UNIX timestamp `-62135596800`,

    equivalent to 0001-01-01 00:00:00 UTC

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_ad()
        ...
        datetime.datetime(1710, 12, 10, 4, 39, 16, 36270)
        datetime.datetime(1535, 11, 6, 1, 42, 15, 946022)
        datetime.datetime(852, 8, 25, 14, 56, 9, 141365)
        datetime.datetime(525, 4, 21, 5, 13, 43, 861954)
        datetime.datetime(1036, 4, 28, 12, 3, 1, 636246)

  date_time_between(start_date: date | datetime | timedelta | str | int = '-30y', end_date: date | datetime | timedelta | str | int = 'now', tzinfo: tzinfo | None = None) → datetime

    Get a datetime object based on a random date between two given dates. Accepts date strings that can be recognized by strtotime().

    Parameters:

      - start_date – A `DateParseType`. Defaults to 30 years ago

      - end_date – A `DateParseType`. Defaults to `"now"`

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_between()
        ...
        datetime.datetime(2021, 4, 25, 12, 39, 25, 236214)
        datetime.datetime(2018, 9, 21, 2, 4, 11, 808743)
        datetime.datetime(2008, 8, 7, 7, 33, 52, 361449)
        datetime.datetime(2003, 10, 2, 0, 44, 28, 49189)
        datetime.datetime(2011, 4, 28, 4, 1, 24, 171082)

  date_time_between_dates(datetime_start: date | datetime | timedelta | str | int | None = None, datetime_end: date | datetime | timedelta | str | int | None = None, tzinfo: tzinfo | None = None) → datetime

    Get a random datetime between the two given datetimes.

    Parameters:

      - datetime_start – A `DateParseType`. Defaults to the UNIX epoch

      - datetime_end – A `DateParseType`. Defaults to the current date and time

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_between_dates()
        ...
        datetime.datetime(2025, 12, 25, 5, 28, 42)
        datetime.datetime(2025, 12, 25, 5, 28, 42)
        datetime.datetime(2025, 12, 25, 5, 28, 42)
        datetime.datetime(2025, 12, 25, 5, 28, 42)
        datetime.datetime(2025, 12, 25, 5, 28, 42)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_between_dates(datetime_start='-30y', datetime_end='now')
        ...
        datetime.datetime(2021, 4, 25, 12, 39, 25, 236214)
        datetime.datetime(2018, 9, 21, 2, 4, 11, 808743)
        datetime.datetime(2008, 8, 7, 7, 33, 52, 361449)
        datetime.datetime(2003, 10, 2, 0, 44, 28, 49189)
        datetime.datetime(2011, 4, 28, 4, 1, 24, 171082)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_between_dates(datetime_start='now', datetime_end='+1y')
        ...
        datetime.datetime(2026, 10, 29, 15, 28, 39, 441207)
        datetime.datetime(2026, 9, 28, 1, 31, 28, 993625)
        datetime.datetime(2026, 5, 27, 20, 6, 28, 345382)
        datetime.datetime(2026, 3, 29, 19, 4, 49, 534973)
        datetime.datetime(2026, 6, 29, 23, 11, 23, 405703)

  date_time_this_century(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) → datetime

    Gets a datetime object for the current century.

    Parameters:

      - before_now – include days in current century before today. Defaults to True

      - after_now – include days in current century after today. Defaults to False

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_century()
        ...
        datetime.datetime(2021, 12, 9, 18, 8, 48, 939798)
        datetime.datetime(2019, 9, 11, 3, 50, 49, 705995)
        datetime.datetime(2010, 12, 5, 7, 41, 14, 212837)
        datetime.datetime(2006, 9, 23, 4, 17, 50, 924361)
        datetime.datetime(2013, 4, 14, 2, 43, 53, 300146)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_century(before_now=False, after_now=True)
        ...
        datetime.datetime(2088, 6, 25, 23, 31, 35, 228889)
        datetime.datetime(2082, 1, 31, 8, 27, 38, 916894)
        datetime.datetime(2057, 2, 10, 6, 50, 19, 709910)
        datetime.datetime(2045, 2, 22, 23, 36, 14, 980162)
        datetime.datetime(2063, 10, 29, 10, 10, 3, 406054)

  date_time_this_decade(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) → datetime

    Gets a datetime object for the decade year.

    Parameters:

      - before_now – include days in current decade before today. Defaults to True

      - after_now – include days in current decade after today. Defaults to False

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_decade()
        ...
        datetime.datetime(2025, 1, 19, 6, 6, 28, 506060)
        datetime.datetime(2024, 7, 14, 7, 16, 52, 381417)
        datetime.datetime(2022, 7, 8, 1, 4, 39, 828287)
        datetime.datetime(2021, 7, 19, 19, 0, 46, 143456)
        datetime.datetime(2023, 1, 22, 6, 2, 50, 358906)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_decade(before_now=False, after_now=True)
        ...
        datetime.datetime(2029, 5, 17, 15, 31, 22, 734794)
        datetime.datetime(2029, 1, 10, 17, 34, 31, 911079)
        datetime.datetime(2027, 9, 3, 12, 45, 8, 56279)
        datetime.datetime(2027, 1, 9, 6, 12, 53, 450609)
        datetime.datetime(2028, 1, 14, 15, 54, 30, 179677)

  date_time_this_month(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) → datetime

    Gets a datetime object for the current month.

    Parameters:

      - before_now – include days in current month before today. Defaults to True

      - after_now – include days in current month after today. Defaults to False

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_month()
        ...
        datetime.datetime(2025, 12, 21, 11, 0, 46, 839078)
        datetime.datetime(2025, 12, 19, 8, 44, 2, 626672)
        datetime.datetime(2025, 12, 11, 4, 33, 11, 742728)
        datetime.datetime(2025, 12, 7, 6, 33, 16, 129557)
        datetime.datetime(2025, 12, 13, 9, 17, 42, 622285)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_month(before_now=False, after_now=True)
        ...
        datetime.datetime(2025, 12, 30, 22, 42, 54, 648046)
        datetime.datetime(2025, 12, 30, 8, 39, 44, 446163)
        datetime.datetime(2025, 12, 28, 1, 49, 49, 179369)
        datetime.datetime(2025, 12, 26, 23, 33, 28, 494428)
        datetime.datetime(2025, 12, 28, 16, 34, 17, 591429)

  date_time_this_year(before_now: bool = True, after_now: bool = False, tzinfo: tzinfo | None = None) → datetime

    Gets a datetime object for the current year.

    Parameters:

      - before_now – include days in current year before today. Defaults to True

      - after_now – include days in current year after today. Defaults to False

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_year()
        ...
        datetime.datetime(2025, 10, 30, 11, 53, 54, 861647)
        datetime.datetime(2025, 9, 29, 12, 29, 47, 604962)
        datetime.datetime(2025, 5, 31, 15, 51, 18, 193712)
        datetime.datetime(2025, 4, 3, 18, 1, 52, 142811)
        datetime.datetime(2025, 7, 3, 3, 40, 24, 21652)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.date_time_this_year(before_now=False, after_now=True)
        ...
        datetime.datetime(2025, 12, 30, 22, 42, 54, 648046)
        datetime.datetime(2025, 12, 30, 8, 39, 44, 446163)
        datetime.datetime(2025, 12, 28, 1, 49, 49, 179369)
        datetime.datetime(2025, 12, 26, 23, 33, 28, 494428)
        datetime.datetime(2025, 12, 28, 16, 34, 17, 591429)

  day_of_month() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.day_of_month()
        ...
        '10'
        '07'
        '18'
        '30'
        '16'

  day_of_week() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.day_of_week()
        ...
        'Monday'
        'Thursday'
        'Sunday'
        'Saturday'
        'Sunday'

  future_date(end_date: date | datetime | timedelta | str | int = '+30d') → date

    Get a Date object based on a random date between 1 day from now and a given date.

    Parameters:

      - end_date – A `DateParseType`. Defaults to `"+30d"`

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.future_date()
        ...
        datetime.date(2026, 1, 19)
        datetime.date(2026, 1, 16)
        datetime.date(2026, 1, 7)
        datetime.date(2026, 1, 2)
        datetime.date(2026, 1, 9)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.future_date(end_date='+1y')
        ...
        datetime.date(2026, 10, 29)
        datetime.date(2026, 9, 27)
        datetime.date(2026, 5, 28)
        datetime.date(2026, 3, 30)
        datetime.date(2026, 6, 30)

  future_datetime(end_date: date | datetime | timedelta | str | int = '+30d', tzinfo: tzinfo | None = None) → datetime

    Get a datetime object based on a random date between 1 second form now and a given date.

    Parameters:

      - end_date – A `DateParseType`. Defaults to `"+30d"`

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.future_datetime()
        ...
        datetime.datetime(2026, 1, 19, 13, 27, 43, 594731)
        datetime.datetime(2026, 1, 16, 23, 12, 20, 54467)
        datetime.datetime(2026, 1, 6, 20, 17, 24, 116942)
        datetime.datetime(2026, 1, 1, 23, 53, 54, 957843)
        datetime.datetime(2026, 1, 9, 13, 35, 46, 566513)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.future_datetime(end_date='+1y')
        ...
        datetime.datetime(2026, 10, 29, 15, 28, 39, 596785)
        datetime.datetime(2026, 9, 28, 1, 31, 29, 235670)
        datetime.datetime(2026, 5, 27, 20, 6, 28, 924810)
        datetime.datetime(2026, 3, 29, 19, 4, 50, 276056)
        datetime.datetime(2026, 6, 29, 23, 11, 23, 894428)

  iso8601(tzinfo: tzinfo | None = None, end_datetime: date | datetime | timedelta | str | int | None = None, sep: str = 'T', timespec: str = 'auto') → str

    Get an ISO 8601 string for a datetime between the UNIX epoch and now.

    Parameters:

      - tzinfo – timezone, instance of datetime.tzinfo subclass

      - end_datetime – A `DateParseType`. Defaults to the current date and time

      - sep – separator between date and time, defaults to ‘T’

      - timespec – format specifier for the time part, defaults to ‘auto’ - see datetime.isoformat() documentation

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.iso8601()
        ...
        '2017-04-10T02:04:20.566417'
        '2012-06-07T01:36:02.062654'
        '1993-07-18T12:33:17.097369'
        '1984-06-30T03:07:02.892104'
        '1998-08-16T03:37:20.644043'

  month() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.month()
        ...
        '04'
        '06'
        '07'
        '06'
        '08'

  month_name() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.month_name()
        ...
        'April'
        'June'
        'July'
        'June'
        'August'

  past_date(start_date: date | datetime | timedelta | str | int = '-30d', tzinfo: tzinfo | None = None) → date

    Get a Date object based on a random date between a given date and 1 day ago.

    Parameters:

      - start_date – A `DateParseType`. Defaults to `"-30d"`

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.past_date()
        ...
        datetime.date(2025, 12, 19)
        datetime.date(2025, 12, 16)
        datetime.date(2025, 12, 7)
        datetime.date(2025, 12, 2)
        datetime.date(2025, 12, 9)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.past_date(start_date='-1y')
        ...
        datetime.date(2025, 10, 28)
        datetime.date(2025, 9, 26)
        datetime.date(2025, 5, 26)
        datetime.date(2025, 3, 28)
        datetime.date(2025, 6, 28)

  past_datetime(start_date: date | datetime | timedelta | str | int = '-30d', tzinfo: tzinfo | None = None) → datetime

    Get a datetime object based on a random date between a given date and 1 second ago.

    Parameters:

      - start_date – A `DateParseType`. Defaults to `"-30d"`

      - tzinfo – timezone, instance of datetime.tzinfo subclass

    Example:

      datetime(‘1999-02-02 11:42:52’)

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.past_datetime()
        ...
        datetime.datetime(2025, 12, 20, 13, 27, 42, 594731)
        datetime.datetime(2025, 12, 17, 23, 12, 19, 54467)
        datetime.datetime(2025, 12, 7, 20, 17, 23, 116942)
        datetime.datetime(2025, 12, 2, 23, 53, 53, 957843)
        datetime.datetime(2025, 12, 10, 13, 35, 45, 566513)

  pytimezone(*args: Any, **kwargs: Any) → tzinfo | None

    Generate a random timezone (see `faker.timezone` for any args) and return a Python object usable as a `tzinfo` for `datetime` or other fakers.

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.pytimezone()
        ...
        zoneinfo.ZoneInfo(key='Indian/Maldives')
        zoneinfo.ZoneInfo(key='America/Barbados')
        zoneinfo.ZoneInfo(key='Europe/Stockholm')
        zoneinfo.ZoneInfo(key='Africa/Windhoek')
        zoneinfo.ZoneInfo(key='Asia/Qatar')

  time(pattern: str = '%H:%M:%S', end_datetime: date | datetime | timedelta | str | int | None = None) → str

    Get a time string (24h format by default)

    Parameters:

      - pattern – format

      - end_datetime – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.time()
        ...
        '02:04:20'
        '01:36:02'
        '12:33:17'
        '03:07:02'
        '03:37:20'

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.time(pattern='%I:%M %p')
        ...
        '02:04 AM'
        '01:36 AM'
        '12:33 PM'
        '03:07 AM'
        '03:37 AM'

  time_delta(end_datetime: date | datetime | timedelta | str | int | None = None) → timedelta

    Get a random timedelta object of duration between the current date and time and end_datetime

    Parameters:

      end_datetime – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.time_delta()
        ...
        datetime.timedelta(0)
        datetime.timedelta(0)
        datetime.timedelta(0)
        datetime.timedelta(0)
        datetime.timedelta(0)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.time_delta(end_datetime='+30h')
        ...
        datetime.timedelta(days=1, seconds=4797, microseconds=559965)
        datetime.timedelta(seconds=81859, microseconds=75518)
        datetime.timedelta(seconds=45421, microseconds=730730)
        datetime.timedelta(seconds=27963, microseconds=9032)
        datetime.timedelta(seconds=55217, microseconds=669908)

  time_object(end_datetime: date | datetime | timedelta | str | int | None = None) → time

    Get a time object

    Parameters:

      end_datetime – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.time_object()
        ...
        datetime.time(2, 4, 20, 566417)
        datetime.time(1, 36, 2, 62654)
        datetime.time(12, 33, 17, 97369)
        datetime.time(3, 7, 2, 892104)
        datetime.time(3, 37, 20, 644043)

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.time_object(end_datetime='+1h')
        ...
        datetime.time(2, 55, 0, 485083)
        datetime.time(2, 21, 30, 698505)
        datetime.time(12, 58, 31, 155060)
        datetime.time(3, 22, 34, 992405)
        datetime.time(4, 8, 1, 233040)

  time_series(start_date: date | datetime | timedelta | str | int = '-30d', end_date: date | datetime | timedelta | str | int = 'now', precision: float | None = None, distrib: Callable[[datetime], float] | None = None, tzinfo: tzinfo | None = None) → Iterator[Tuple[datetime, Any]]

    Returns a generator yielding tuples of `(<datetime>, <value>)`.

    The data points will start at `start_date`, and be at every time interval specified by `precision`.

    Parameters:

      - start_date – A `DateParseType`. Defaults to `"-30d"`

      - end_date – A `DateParseType`. Defaults to `"now"`

      - precision – A float representing the time interval between data points.

    Defaults to 1/30th of the time :param distrib: A callable that accepts a datetime object and returns a value. Defaults to a uniform distribution :param tzinfo: timezone, instance of datetime.tzinfo subclass

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.time_series()
        ...
        <generator object Provider.time_series at 0x7d65fc302d40>
        <generator object Provider.time_series at 0x7d65fc302d40>
        <generator object Provider.time_series at 0x7d65fc302d40>
        <generator object Provider.time_series at 0x7d65fc302d40>
        <generator object Provider.time_series at 0x7d65fc302d40>

  timezone() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.timezone()
        ...
        'Indian/Maldives'
        'America/Barbados'
        'Europe/Stockholm'
        'Africa/Windhoek'
        'Asia/Qatar'

  unix_time(end_datetime: date | datetime | timedelta | str | int | None = None, start_datetime: date | datetime | timedelta | str | int | None = None) → float

    Get a timestamp between January 1, 1970 and now, unless passed explicit `start_datetime` or end_datetime values.

    On Windows, the decimal part is always 0.

    Parameters:

      - end_datetime – A `DateParseType`. Defaults to the UNIX epoch

      - start_datetime – A `DateParseType`. Defaults to the current date and time

    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.unix_time()
        ...
        1491789860.5664175
        1339032962.0626543
        742998797.0973692
        457412822.89210445
        903238640.6440431

  year() → str
    Examples:

        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.year()
        ...
        '2017'
        '2012'
        '1993'
        '1984'
        '1998'