Add and Compare Datetime in Python

How to write this pseudo code in Python? With 'created_date' is a datetime object.

if (created_date + 30days) < now: print 'valid' else: print 'expired' 
+4
source share
1 answer
 import datetime as DT if (created_date + DT.timedelta(days=30)) < DT.datetime.now(): print('valid') else: print('expired') 
+14
source

Source: https://habr.com/ru/post/1346160/


All Articles