Every developer knows datetime.strftime() method, but some don't know that its argument's format is not documented in full in the official documentation. For example, you won't find any mention of %s directive there which means UNIX epoch time, timestamp. It works (at least with every major version of Python on Linux, FreeBSD, and MacOS), I've tested it a few times myself, it's just not documented. I recently saw a piece of code where developers, being unaware of such a directive, used custom format string with both datetime.now() and time.time(), a function generator, and on top of it messed with model migrations (it all was about FileField.upload_to if you know what I'm talking about) when they could just use %s. From other undocumented features you might be interested in these: %C is a century (%Y//100), could be helpful for complimenting %y or something, I guess. %u is a weekday number with Monday as 1 and Sunday as 7 (as opposed to %w represen...
Some technical and not so technical stuff about my work, open-source and other projects. Reviews of recent technologies, tips and tricks I use.