Script:
datetime.datetime.now()
will give
datetime.datetime(2019, 4, 9, 19, 55, 45, 938208)
And I want to convert like:
201949195545938208
I need this to create unique folder.
Using strftime():
import datetime
print(datetime.datetime.now().strftime("%Y%m%d%H%M%S%z"))
OUTPUT:
20190409193226
EDIT:
Use %f, if you want to tag along the milliseconds as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With