How to format date? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to format date?

https://code.sololearn.com/cwb7Vzk7hnc4/?ref=app Why does it change format in second print statement? how do i retain format from 1st print statement? how do I Google search this? the date I receive using today was easily processed. what changes should I do on date_series?

3rd Aug 2022, 7:36 AM
Subham
Subham - avatar
1 Answer
+ 5
Subham , formatting date (if they are datetime objects) can be done by using the method strftime(...). we can use placeholders to get the required output result. https://strftime.org/ if you have a pandas datetime series (date range), you need to iterate over this object to get the individual datetime objects. they can also be formatted as described above.
3rd Aug 2022, 3:55 PM
Lothar
Lothar - avatar