Hacker News new | ask | show | jobs
by dalke 4241 days ago
According to the documentation there's a 'default' parameter, which contains the datetime used to get otherwise unspecified fields. If not given, the default is the current date. Thus to get what you want:

    >>> from datetime import datetime
    >>> from dateutil import parser
    >>> now = datetime.now()
    >>> first = datetime(now.year, now.month, 1, 12, 0, 0)
    >>> dateutil.parser.parse('February 2006', default=first)
    datetime.datetime(2006, 2, 1, 12, 0)