Re: [Python-Dev] datetime and timedelta enhancement

2008-11-17 Thread M.-A. Lemburg
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

Re: [Python-Dev] datetime and timedelta enhancement

2008-11-15 Thread M.-A. Lemburg
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 #4291:

Re: [Python-Dev] datetime and timedelta enhancement

2008-11-15 Thread Nick Coghlan
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 them

[Python-Dev] datetime and timedelta enhancement

2008-11-14 Thread Victor Stinner
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 #4291: Allow Division of datetime.timedelta Objects

Re: [Python-Dev] datetime and timedelta enhancement

2008-11-14 Thread Victor Stinner
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

Re: [Python-Dev] datetime and timedelta enhancement

2008-11-14 Thread Victor Stinner
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__ on

Re: [Python-Dev] datetime and timedelta enhancement

2008-11-14 Thread Victor Stinner
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.)