Anthony stark Posted March 10, 2020 Share Posted March 10, 2020 Hi Guys have the follow lince of code below: import datetime todayDate = Document.Properties['CurrentDateTimeProperty'] if todayDate.day is 1: myFunction() else: pass The error im getting when i run this is: "AttributeError: 'DateTime' object has no attribute 'day' when i try : if todayDate.day = 1: (instead of using "is"), i get this error: SyntaxError: unexpected token '=' How can i get the code to recognise the ['CurrentDateTimeProperty'] property Thaanks in advance Link to comment Share on other sites More sharing options...
Tyger Guzman 2 Posted March 10, 2020 Share Posted March 10, 2020 While the document property may be a datetime it does not have the method .day You can wrap your document property in datetime.datetime() so that is has the .day method. import datetime todayDate = datetime.datetime(Document.Properties['CurrentDateTimeProperty']) if todayDate.day == 1: myfunc() else: pass Link to comment Share on other sites More sharing options...
Anthony stark Posted March 10, 2020 Author Share Posted March 10, 2020 Thanks Tyger0951 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now