check prettydate 
http://web2py.com/books/default/chapter/29/14?search=prettydate

On Wednesday, April 10, 2013 3:45:19 PM UTC+2, 黄祥 wrote:
>
> brilliant, very simple solution, it's work now.
> thank you so much for your solution and suggestion, massimo
> i've followed your hints and make it on my controller :
> def __onvalidation_check_out(form):
>     if form.vars.check_in:
>         rows = db(db.check_in.id==form.vars.check_in).select()
>         for row in rows:
>             form.vars.room = row.room
>             form.vars.guest = row.guest
>             form.vars.price = row.room.category.price
>             delta = request.now - row.created_on
>             form.vars.duration = delta
>             form.vars.total_price = delta.days * row.room.category.price
>     else:
>         form.errors.check_in = 'enter a value'
>
> another question is it possible to make time delta more human readable?
> for example on my code above the time delta return :
> 9 days, 0:00:34.024219
> is it possible to make it?
> 9 days, 0:00:34.024219 = 9 days, 34 seconds
> 9 days, 0:01:34.024219 = 9 days 1 minute 34 seconds
> 9 days, 0:02:34.024219 = 9 days 2 minutes 34 seconds
> 9 days, 1:01:34.024219 = 9 days 1 hour 1 minute 34 seconds
> 9 days, 2:01:34.024219 = 9 days 2 hours 1 minute 34 seconds
>
> thanks and best regards
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to