Hi Ujwal Singh Bagel,
Try this code below.
import datetime
i = datetime.datetime.now()
print ("Current date & time = %s" % i)
if self.date_from <= str(i):
print 'You cannot select the previous date'
OR
from datetime import date
if self.date_from <= str(date.today()):
print 'You cannot select the previous date'
for instance
from datetime import date
if "10/07/2017" <= str(date.today()):
print 'You cannot select the previous date'
Conclusion:
You cannot select the previous date.
Hope my answer will be helpful. If any request comments like this, please.
source
share