N
N
NikClik2018-08-30 16:50:50
Python
NikClik, 2018-08-30 16:50:50

How to get the current date and time in a specific format?

using datetime.datetime.now() I get the date in the format 2018-08-30 16:49:10.029505, but I need to get it in the format 2018-08-28 16:49:10+00:00, I don’t know how to process it, can you advise?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Alekseev, 2018-08-30
@NikClik

datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")

I
Ilya Rusin, 2018-08-30
@ruballoo

dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S+00:00')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question