SyntaxFix
Write A Post
Hire A Developer
Questions
I found this to be the simplest way.
>>> t = datetime.datetime.now() >>> t datetime.datetime(2018, 11, 30, 17, 21, 26, 606191) >>> t = str(t).split('.') >>> t ['2018-11-30 17:21:26', '606191'] >>> t = t[0] >>> t '2018-11-30 17:21:26' >>>