Expressing time.

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Jul 14 11:39:15 EDT 2003


>>>>> "Sean" == Sean  <null-spam at tfh.ca> writes:


    Sean> Is there any python facilities to make this an easier chore
    Sean> (aka time.localtime()+months(3))?  (I included months as it
    Sean> is a special case in that you can't just arbitrarily
    Sean> calculate months in seconds without being relative to a
    Sean> particular month).

The mx.DateTime package does what you need:

Eg,

from mx.DateTime import now, RelativeDateTime, DateTime
date2 =  now()
date1 = date2 + RelativeDateTime(days=-7)  # 7 days ago






More information about the Python-list mailing list