On 2008-11-16 02:14, Nick Coghlan wrote: > M.-A. Lemburg wrote: >> Guess I could add a .weeks attribute to mxDateTime, but no one ever >> asked for that so far. > > Given that there are at least 3 different ways to define the number of > "weeks" between two dates, it may be something best left to applications > to worry about.
I'd just use the term "weeks" as meaning 7 full days and then return a float value for fractions. That's the same convention used for .days. Anything more complicated would need to use DateTime values (see below). > OOo implements 2 of them [1] for its WEEKS() function, and there's then > a fairly obvious 3rd variant based on a Sunday to Saturday week. > > Cheers, > Nick. > > [1] > http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Calc:_WEEKS_function If you need ISO week counting or any other date based counting mechanism, you need to know the two DateTime values you're dealing with and possibly the calendar you're using. mxDateTime has an .iso_week attribute to help with this, e.g. >>> Date(2008,11,17).iso_week (2008, 47, 1) http://en.wikipedia.org/wiki/ISO_week -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 17 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2008-11-12: Released mxODBC.Connect 0.9.3 http://python.egenix.com/ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com