Contact: aviboots(AT)netvision.net.il
39,938 questions
51,875 answers
573 users
from datetime import datetime print(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]) print(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-2]) s = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] print(s) ''' run: 2020-01-03 17:09:01.57884 2020-01-03 17:09:01.5789 2020-01-03 17:09:01.578 '''
from datetime import datetime print(datetime.utcnow().isoformat(sep=' ', timespec='milliseconds')) print(datetime.now().isoformat(sep=' ', timespec='milliseconds')) ''' run: 2020-01-04 20:16:06.330 2020-01-04 20:16:06.330 '''