thanks
On Tue, Dec 21, 2010 at 6:50 AM, mdipierro <[email protected]> wrote:
> The easyest way is this:
>
> class TimeInterval(object):
> def __init__(self,error_message='not a valid time interval'):
> self.error_message=error_message
> def call(self,value):
> try:
> a,b=[int(x.strip()) for x in value.split(',')]
> return (a*24+b,None)
> except: return (value,self.error_message)
> def formatter(self,value):
> if value==None: return None
> return '%s, %s' % divmod(value,24)
>
> Field('timeinterval','integer',requires=TimeInterval())
>
> It will take values like "5,6" for 5 days and 6 hours.
>
> On Dec 20, 7:14 pm, Sahil Arora <[email protected]> wrote:
> > I want to take input time to complete a task in format no. of
> > days,hours (time interval) in web2py. Is there any defined field,type
> > for this in SQLField. time module in python allows only max 24 hours
> > time.
>
--
Sahil Arora
B.Tech 2nd year
Computer Science and Engineering
IIT Delhi
Contact No: +91 9871491046