Skip to content

Tag: strftime

How to get strftime to output yearly quarters?

I am trying to create a list of year-quarters in python; per the documentation (https://pandas.pydata.org/docs/reference/api/pandas.Period.strftime.html), %q (I believe) should output an integer representation of calendar quarter, but instead the output I get is just %q literally. Input: Expected Output: Actu…

Unexpected datetime behavior

I have a Django project where I used the strftime function like this in models.py: However, for some reason this returns a ValueError, even though according to a documentation (https://www.programiz.com/python-programming/datetime/strftime) this is a valid format string. Once I removed all the dashes, it work…