News for hackers. Stuff that matters.
Re:ISO week date by mikro2nd on Thursday December 26, 2019 @08:07AM (#21883498)
Note that `strftime` (and implementations dependent on it - hello Python!) do not implement ISO week numbers. In `strftime` all days preceding the first Sunday/Monday (depending which date-code you pass to the function) in a year are classified as "Week 0" as opposed to the ISO definition. This means that `strftime` week numbers are generally 1 less than the ISO week number.

As serendipity would have it I was delving into this issue just this morning... :O

Re:ISO week date by fanf2 on Thursday December 26, 2019 @08:25AM (#21883604)
Here is how to format an ISO week date with strftime:

“%G-W%V-%u”

This is in POSIX

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition...

and C99

http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf

Python’s documentation explicitly says it only describes the C89 formatting codes and that C99 has more features. https://docs.python.org/2.7/library/datetime.html#strftime-s...

Re:ISO week date by bshipp on Thursday December 26, 2019 @10:07AM (#21884273)
While it's fine and good that ISO has defined week numbers, it has been less than helpful when working with North American firms whose weeks start on Sunday and who expect January 1st to be week 1. I've ended up having to write custom code to handle this in my programs as most generic libraries support ISO and not much else.
Re:ISO week date by jontro on Thursday December 26, 2019 @08:14AM (#21883548)
Yeah, there is a lot of languages missing iso week support. Probably because it's not used in the US as much. Found this gist for getting using it in Power BI a couple of weeks ago https://gist.github.com/r-k-b/18d898e5eed786c9240e3804b167a5...
Re:ISO week date by petters on Thursday December 26, 2019 @02:35PM (#21886096)
Python 3.6+ added this.