On Friday, December 9, 2016 at 8:31:37 AM UTC-8, Amit Kumar Modak wrote: > > How to get the difference of two date field in years. > dateutil.relativedelta.relativedelta is not working as it is not able to > recognise date fields as date. > > > datetime.timedelta ?
<URL:https://docs.python.org/2/library/datetime.html> If you subtract 2 datetime.datetime objectss or 2 datetime.date objects, you get a datetime.timedelta which will tell you the number of days, and then you divide by 365, or 365.25 if you expect leap years to be important (it will be a while before the skip rules apply; we're 16 years past the last one). datetime has several ways of making date objects, and web2py uses some of them. If you just have a time from the usual epoch, then the python time module might help. . /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.