[Tutor] datetime.timedelta Output Format

William Allison allison.william at comcast.net
Mon Apr 2 11:24:00 CEST 2007


Alan Gauld wrote:
> "R. Alan Monroe" <amonroe at columbus.rr.com> wrote
>
>   
>>> Is there a way to have the output of "print tis" in the same format 
>>> as
>>> "print now" and "print tafmsd" in the code below?
>>>       
>
>   
>>>  >>> now = datetime.date.today()
>>>  >>> print now
>>> 2007-04-01
>>>  >>> tis = now - tafmsd
>>>  >>> print tis
>>> 4785 days, 0:00:00
>>>       
>
>   
>> That's kind of like asking how to say "128 shopping days left until
>> Christmas" in the format of "2007-04-01 shopping days left until
>> Christmas". It doesn't work, somehow.
>>     
>
> I assume that what Will really means is how does he
> get the number of days expressed as a number of
> years/months and days.
>
> As in: There are 4 months, 8 days to Xmas.
>   
Yes, that's correct.  Sorry I didn't express myself clearly.
Thanks again,
Will



More information about the Tutor mailing list