How Can Pass The Current Datetime To String In Python?
I'm trying to pass the current date and time of activities to string value so that whenever I saved my picture or anything during the program it can be saved by its own certain nam
Solution 1:
Use strftime
now.strftime("%Y-%m-%d %H-%M-%S")
Solution 2:
You can convert the timestamp to a string and then can use the replace() method to change the :
to -
str(now).replace(":","-")
Post a Comment for "How Can Pass The Current Datetime To String In Python?"