[Python-bugs-list] [ python-Feature Requests-414055 ] Date/time functions

noreply@sourceforge.net noreply@sourceforge.net
Mon, 16 Dec 2002 20:05:25 -0800


Feature Requests item #414055, was opened at 2001-04-05 13:19
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=414055&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Cera (timcera)
>Assigned to: Tim Peters (tim_one)
Summary: Date/time functions

Initial Comment:
Currently:
>>> import time
>>> a =
time.localtime(time.mktime((2002,5,1,1,0,0,0,0,-1)))
>>> a
(2002, 5, 1, 1, 0, 0, 2, 121, 1)

And then that is it.  What I would like is to have more
date/time functions.

For example:
>>> date_add((2002, 5, 1, 1, 0, 0, 2, 121, 1),(0, 14,
0, 0, 0, 0, 0, 0, 0))
(2003,7,1,1,0,0,1,182,1)

Would add 14 months to (2002, 5, 1, 1, 0, 0, 2, 121,
1), incrementing the other values as needed.

If could have a date data type, could overload '+',
'-', ...etc.

>>> (2002, 5, 1, 1, 0, 0, 2, 121, 1)+(0, 14, 0, 0, 0,
0, 0, 0, 0)
(2003,7,1,1,0,0,1,182,1)

thanks


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-12-16 23:05

Message:
Logged In: YES 
user_id=33168

Tim (Peters), can we close this now that you've implemented
dates and times for 2.3?

----------------------------------------------------------------------

Comment By: Brian Mansell (bmansell)
Date: 2001-04-10 15:31

Message:
Logged In: YES 
user_id=93795

Tim,

You may want to use the mxDateTime module to do what your 
requesting.

For example...

from mx.DateTime import *
print now() + RelativeDateTime(months=+14)

... would return June, 10..etc.. 



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=414055&group_id=5470