
year > rdelta = relativedelta ( easter ( year ), today ) > print ( "Today is: %s " % today ) Today is : 2003 - 10 - 11 > print ( "Year with next Aug 13th on a Friday is: %s " % year ) Year with next Aug 13 th on a Friday is : 2004 > print ( "How far is the Easter of that year: %s " % rdelta ) How far is the Easter of that year : relativedelta ( months =+ 6 ) > print ( "And the Easter of that year is: %s " % ( today + rdelta )) And the Easter of that year is : 2004 - 04 - 11īeing exactly 6 months ahead was really a coincidence :) Contributing date () > year = rrule ( YEARLY, dtstart = now, bymonth = 8, bymonthday = 13, byweekday = FR ).

Here is the code: > from dateutil.relativedelta import * > from dateutil.easter import * > from dateutil.rrule import * > from dateutil.parser import * > from datetime import * > now = parse ( "Sat Oct 11 17:13:" ) > today = now. Year with a Friday 13th in August, and you want to get today’sĭate out of the “date” unix system command. Years/months/days/etc, before the next easter happening on a Suppose you want to know how much time is left, in For more examples, look at the documentation. Here’s a snapshot, just to give an idea about the power of the Using Western, Orthodox or Julian algorithms Internal up-to-date world timezone information based onĬomputing of Easter Sunday dates for any given year, Local machine timezone, fixed offset timezone, UTC timezone, Timezone (tzinfo) implementations for tzfile(5) formatįiles (/etc/localtime, /usr/share/zoneinfo, etc), TZĮnvironment string (in all known formats), iCalendarįormat files, given ranges (with help from relative deltas), Generic parsing of dates in almost any string format Parsing of RFC strings is supported as well. The code and issue tracker are hosted on GitHub:Ĭomputing of relative deltas (next month, next year,Ĭomputing of relative deltas between two givenĬomputing of dates based on very flexible recurrence rules, Installationĭateutil can be installed from PyPI using pip (note that the package name isĭifferent from the importable name): pip install python-dateutil Download The standard datetime module, available in Python. The dateutil module provides powerful extensions to Dateutil - powerful extensions to datetime
