How to find out the next Friday using RelativeDateTime

fumanchu fumanchu at amor.org
Thu Mar 23 21:02:48 CET 2006


> a = now()
> delta = ReltaiveDateTime(days=+6, weekday(mx.DateTime.Friday, 0))
> Next Friday: a+delta
> a: march 23
> a+delta: Gives me March 31st and not March 24th
> Any ideas?

Just an off-beat idea: use Python's datetime instead of mx.DateTime,
and my recur module:
http://projects.amor.org/misc/wiki/Recur

>>> import datetime, recur
>>> recur.Recurrence(datetime.date.today(), "Friday").next()
datetime.date(2006, 3, 24)


Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list