Date: 16 Jan 2023
Module: python-dateutil Installation: pip install python-dateutil About: Generic parsing of dates in almost any string format. Computing of relative deltas (next month, next year, next Monday, last week of month, etc). Computing of relative deltas between two given date and/or datetime objects. Source: >>> 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:46 UTC 2003") >>> today = now.date() >>> print("Today is: %s" % today) Today is: 2003-10-11 >>> year = rrule(YEARLY,dtstart=now,bymonth=8,bymonthday=13,byweekday=FR)[0].year >>> print("Year with next Aug 13th on a Friday is: %s" % year) Year with next Aug 13th on a Friday is: 2004 >>> rdelta = relativedelta(easter(year), today) >>> 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 Reference: https://pypi.org/project/python-dateutil/
_______________________________________________ Chennaipy mailing list Chennaipy@python.org https://mail.python.org/mailman/listinfo/chennaipy