Reputation: 29
Let's say I have a number "5".
How can I check if a DateTimeField
value contains that number?
"25/10/15" should be true, while "20/10/12" should be false.
Upvotes: 0
Views: 39
Reputation: 10621
Simple one line code.
from datetime import datetime
print ('5' in (str(datetime.now().strftime("%d/%m/%y"))))
Upvotes: 2