from datetime import datetime print datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] >>>> OUTPUT >>>> 2020-05-04 10:18:32.926