Skip to content
Advertisement

How to get formatted date time in python

I want my Linux Filename like this

JavaScript

How can i get the date variable formatted like above in Python

IN bash i write

JavaScript

Advertisement

Answer

You can use the same formatting string in strftime on a datetime object:

JavaScript

Incidentally, I’d just like to put a word in for the joy of ISO-8601 date formatting

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement