I get the following error when the codenippet is executing below, I created "DueDate" and "Date", what This is because both of them are in different time formats? How to convert to "Date Created" as "vs Date"
Error: -
< Code> Type Error: - 'Text' and 'datetime.datetime'
Code SNIPPET: -
If ((none!): Unsupported operation type (s) = DueDate) and (DueDate - CreatedDate) .days & lt; 1)): Sample Input: -
Due Date 2/6/2015 Created Date 2015 -02-03 20: 15: 47.950000You need to change your date The string for the
datetimeobject. There is no underlying conversion in the string from thedatetimeobject. You can try something like the following.Import date time = "3/17/2015" # I used place instead of now to create your datetime object Gone Datetime_object = datetime.datetime.now () due_date = datetime.datetime.strptime (date, "% m /% d /% Y") If set_data! = None and (datetime_object - due_date). Day & lt; 1: print ("clever messaging")edit
Thanks for comment by @JFSBeeton I
time.strptime. See the comments below for details.
No comments:
Post a Comment