"week-year" conversion to date
Eddie Corns
eddie at holyrood.ed.ac.uk
Wed Sep 14 10:04:00 EDT 2005
oyvgi at hotmail.com writes:
>I was wondering if it there is an "easy" way to get the dd-mm-yyyy from
>ww-yyyy.
>I would like to get, for example the first day (date-month-year) in the
>week i specify. Found plenty of ways to go th other way, but none that
>give me the reverse.
>Idealy I would like both the beginning date/time and the end date/time
>of the specified week, but if i can just get a hold one of the or some
>other defined time in this week i could probably work out the rest.
>This is in Python :-)
>dd = day in month
>mm = month
>yyyy = year
>ww = week #
>Thanks for any and all help.
>>> import mx.DateTime
>>> d=mx.DateTime.DateTime(1992)+mx.DateTime.RelativeDateTime(weeks=15)
>>> d
<DateTime object for '1992-04-15 00:00:00.00' at 81d5410>
>>> d=mx.DateTime.DateTime(1992)+mx.DateTime.RelativeDateTime(weeks=51)
>>> d
<DateTime object for '1992-12-23 00:00:00.00' at 81d5448>
Eddie
More information about the Python-list
mailing list