parse dates

Eddie Corns eddie at
Mon Jun 2 16:26:59 CEST 2008

brechmos <brechmos at> writes:


>I have been using PHP the last while and in particular strtotime.
>What I want to replicate is finding the second or fourth Monday of the
>next month.  In PHP with strtotime it is easy (strtotime("second
>Monday", strtotime("next month"), but I can't find an easy way to do
>it in Python.  I have seen DateUtil, but it seems to be able to do
>only the simpler parsing (could be wrong).

>Any other ideas?

>>> import parsedatetime.parsedatetime as pdt
>>> p = pdt.Calendar()
>>> p.parse('next month')
((2008, 7, 1, 9, 0, 0, 1, 183, -1), 1)


More information about the Python-list mailing list