Think you can use either the 'today' or 'now' function of datetime.datetime:On my computer, if I do this at IDLE's command line to test returns of both functions they seem to behave similarly:>>> testNow = datetime.datetime.now(); testToday = datetime.datetime.today() This is the result (the same time):>>> print testNow2013-02-12 06:20:12.998000>>> print testToday2013-02-12 06:20:12.998000Here's the thing though - you have 2 lines in your def function that converts the 'fed' time values and converts only the date component into a string that includes backslashes '/' --- c1 = datetime.datetime.strptime (d1.split () [0], "%Y/%m/%d")c2 = datetime.datetime.strptime (d2.split () [0], "%Y/%m/%d")...so 'strptime' needs 2 parameters - '.split()[0]' requires the 'd' values to be string and the 2nd parameter for formatting '%Y/%m/%d' assumes that '/' is in the string, not the '-' that is returned on my system. So you may have to 'coerce' that to work by changing the explicit formatting, something like this may work, you have to test it:import datetime def NoDays(d1): c1 = datetime.datetime.strptime (d1.split () [0], "%Y/%m/%d") current = datetime.datetime.today() c2 = datetime.datetime.strptime (str(current).split () [0], "%Y-%m-%d") n = (c1 - c2).days return n
...and your expression would be the date in the past, such as:NoDays( !Expiry! ) Hope that helps - I cannot be sure of the formatting "%Y-%m-%d", so if it fails try switching it back to "%Y/%m/%d" (which should still work for your field values).-Wayne