I hate the idea of importing too many modules for convenience. I would rather work with available module which in this case is datetime
rather than calling a new module time
.
>>> a = datetime.datetime(2015, 04, 01, 11, 23, 22)
>>> a.strftime('%Y-%m-%d %H:%M')
'2015-04-01 11:23'