python datetime

Von vontio at gmail.com
Tue Sep 14 10:43:25 CEST 2010


Thank you,the timedelta class is awesome.

On Tue, Sep 14, 2010 at 3:50 PM, Michael Ricordeau <
michael.ricordeau at gmail.com> wrote:

>
> # Determine diff days between two dates
> import datetime
> now = datetime.date(2010, 9, 28)
> next = datetime.date(2010, 10, 5)
> delta = next - now
>
> #delta is datetime.timedelta type.
> #(You can extract days diff)
>
> # Determine date in 7 days
> import datetime
> now = datetime.date(2010, 9, 28)
> delta = datetime.timedelta(days=7)
> next = now + delta
>
>
>
>
>
>
>
>
>
>
> Le Tue, 14 Sep 2010 14:41:09 +0800,
> Von <vontio at gmail.com> a écrit :
>
> > Hi,
> >   How to determine a date is just the 7th day after today
> > ie: today is 14 Sep the 7th day is 14+7 = 21,but assume today is 28 Sep
> the
> > 7th day is 5 Oct,is there simple way to do this work?
> > I wish I explained clear
> >
> > Bests,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100914/4ac65307/attachment.html>


More information about the Python-list mailing list