Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# Birthdate

class telegram.Birthdate(day, month, year=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object describes the birthdate of a user.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `day`, and `month` are equal.

  Available In

  `telegram.ChatFullInfo.birthdate`

  Added in version 21.1.

  Parameters:

    - day (`int`) – Day of the user’s birth; 1-31.

    - month (`int`) – Month of the user’s birth; 1-12.

    - year (`int`, optional) – Year of the user’s birth.

  day

    Day of the user’s birth; 1-31.

    Type:

      `int`

  month

    Month of the user’s birth; 1-12.

    Type:

      `int`

  year

    Optional. Year of the user’s birth.

    Type:

      `int`

  to_date(year=None)

    Return the birthdate as a date object.

    Changed in version 21.2: Now returns a `datetime.date` object instead of a `datetime.datetime` object, as was originally intended.

    Parameters:

      year (`int`, optional) – The year to use. Required, if the `year` was not present.

    Returns:

      The birthdate as a date object.

    Return type:

      `datetime.date`