Search code examples
pythondatetimetimeutcepoch

Convert seconds since epoch to days since 0001-01-01 UTC in Python


I have a time in Python that's represented as seconds since the unix epoch. However Matplotlib wants days since 0001-01-01 UTC (http://matplotlib.org/api/dates_api.html).

How can I convert seconds since the unix epoch to days since 0001-01-01 UTC?


Solution

  • A little more thorough reading of the documentation shows matplotlib.dates.epoch2num