Skip to content
Advertisement

how can I strip the 00:00:00 from a date in python

This might be a really simple question, but I’m using the code below to add 1 day to a date and then output the new date. I found this code online.

JavaScript

this code works but the output its gives me looks like this

JavaScript

but for the rest of my code to run properly I need to get rid of the 00:00:00 so I need an output that looks like this

JavaScript

It seems like there might be a simple solution but I can’t find it.

Advertisement

Answer

Try using:

JavaScript

Check https://www.programiz.com/python-programming/datetime/strftime to learn more.

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