mxDateTime history (Re: mktime, how to handle dates before 01-01-1970 ?)
M.-A. Lemburg
mal at egenix.com
Mon Oct 12 14:34:33 EDT 2009
Chris Rebert wrote:
> On Mon, Oct 12, 2009 at 4:27 AM, Piet van Oostrum <piet at cs.uu.nl> wrote:
>>>>>>> greg <greg at cosc.canterbury.ac.nz> (g) wrote:
>>
>>> g> MRAB wrote:
>>>>> And when someone says "January 30", do they really mean the day before
>>>>> the last day of the month?
>>
>>> g> No, no, that's January -2, a *completely* different thing!
>>
>> But for someone else it would be February -2.
>
> And for still others, it's the last $DAYOFWEEK of the month, which
> just happened to fall on the 30th.
That's a little more complicated:
>>> mx.DateTime.DateTime(2009, 1, 31).day_of_week
5
>>> # which is a ...
>>> mx.DateTime.Weekday[mx.DateTime.DateTime(2009, 1, 31).day_of_week]
'Saturday'
Now:
>>> # "next month, last Saturday"
>>> mx.DateTime.DateTime(2009, 1, 31) + mx.DateTime.RelativeDateTime(months=+1, day=1, weekday=(5, -1))
<mx.DateTime.DateTime object for '2009-02-28 00:00:00.00' at 2ba43f93ebe0>
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Oct 12 2009)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try our new mxODBC.Connect Python Database Interface 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
http://www.egenix.com/company/contact/
More information about the Python-list
mailing list