1.Getting the Current Date and Time
We can use a function called datetime.now() to retrieve the current date and time.
from datetime import datetime
now = datetime.now()
print '%s/%s/%s %s:%s:%s' % (now.year, now.month, now.day, now.hour, now.minute, now.second)
>>>2017/9/30 13:16:54