+ 9

How to get date and time in python?

12th Apr 2019, 2:46 PM
Blah
3 Antworten
+ 6
import datetime now = datetime.datetime.now() print print "Current date and time using str method of datetime object:" print str(now) print print "Current date and time using instance attributes:" print "Current year: %d" % now.year print "Current month: %d" % now.month print "Current day: %d" % now.day print "Current hour: %d" % now.hour print "Current minute: %d" % now.minute print "Current second: %d" % now.second print "Current microsecond: %d" % now.microsecond print print "Current date and time using strftime:" print now.strftime("%Y-%m-%d %H:%M") print print "Current date and time using isoformat:" print now.isoformat() http://pythonandmltrainingcourses.com/courses/best-diploma-in-JUMP_LINK__&&__python__&&__JUMP_LINK-course-in-delhi/
20th Apr 2019, 5:17 AM
rajshivakoti
rajshivakoti - avatar
+ 5
alpha5and5 thanks bro
12th Apr 2019, 2:57 PM
Blah
- 2
سلام
14th Apr 2019, 8:31 AM
حمزه گودرزی