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
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.
OOo implements 2 of t
On 2008-11-14 23:59, Victor Stinner wrote:
> Hi,
>
> There are some interresting tickets about the datetime module:
> #1673409: datetime module missing some important methods
> #1083: Confusing error message when dividing timedelta using /
> #2706: datetime: define division timedelta/timedelta
> #
Le Saturday 15 November 2008 02:01:42 Victor Stinner, vous avez écrit :
> > 1- convert a datetime object to an epoch value (numbers of seconds since
> >the 1st january 1970), eg. with a new totimestamp() method
> > 2- convert a timedelta to a specific unit (eg. seconds, days, weeks,
> > etc.)
>
> 1- convert a datetime object to an epoch value (numbers of seconds since
>the 1st january 1970), eg. with a new totimestamp() method
> 2- convert a timedelta to a specific unit (eg. seconds, days, weeks, etc.)
Another solution is proposed by Christian Heimes: "implement __int__
and __float__
> datetime.totimestamp() can be implemented to produce a float in range
> [-2**31; 2**31-1]
An implementation of this method is proposed as a patch in issue #2736.
--
Victor Stinner aka haypo
http://www.haypocalc.com/blog/
___
Python-Dev mailing list
P