add a few seconds:

>>> from datetime import datetime, timedelta
>>> d1 = datetime.now()
>>> d2 = d1 + timedelta(seconds=5)


difference in seconds:

>>> delta = d2 - d1
>>> delta.days * 86400 + delta.seconds


Richard



On Mar 15, 4:57 pm, Jason Brower <encomp...@gmail.com> wrote:
> I want to have a nifty countdown on my website.  I want your advice on
> if I am doing this right in theory.
> When I click on objects in the page it should add or remove time from a
> main countdown timer.
> So my thought is to take the time that this product will be completed,
> and subtract that from the time that it is now.  I then, somehow,
> convert that to seconds and return that to the view.  I would use a
> jquery plugin to simulate the countdown as well to give people an idea
> of the countdown without have to refresh all the time.
> If you think this is good in thoery great... But how do I take to
> datetime features and add only a few seconds to it, and then, hardest of
> all to me, return the difference of two dates in seconds.
> Best Regards,
> Jason Brower

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to