Hello, I have a model that calculates an integer field with the DateDiff() function. The difference is between an 'expiry_date'(date type) field formatted "mm/dd/yyyy" and the now() function. I want to export this model to a Python script, however it wont allow the VB function to be used. It is a large model that I would rather not rewrite, is there python code that I can use in the tool before I export it to a python script in place of the VB to calculate this integer field??
Solved! Go to Solution.
You can use the datetime module.
Code block:
import datetime
Expression:
(datetime.datetime.now() - datetime.datetime.strptime(!field_with_formatted_date!, "%m/%d/%Y")).days
You can use the datetime module.
Code block:
import datetime
Expression:
(datetime.datetime.now() - datetime.datetime.strptime(!field_with_formatted_date!, "%m/%d/%Y")).days
This works great!
Thanks foir the help.