Search code examples
python-3.xdatetimelimit

What is the maximum date python can store?


Using python datetime module: from datetime import date
what is the farthest in the future I can go while being sure I won't break anything?


Solution

  • From the documentation:

    The latest representable date, date(MAXYEAR, 12, 31).

    But, what is MAXYEAR? Well, is the largest year number allowed in a date or datetime object: 9999

    So, the larger date that you can reach is 12/31/9999