I noticed that my date formatting of today (03.01.19) does not spend the correct calendar week, but “KW: 00” instead of “KW: 01”:
Time.format(Time.now(), “KW: %W”));
I noticed that my date formatting of today (03.01.19) does not spend the correct calendar week, but “KW: 00” instead of “KW: 01”:
Time.format(Time.now(), “KW: %W”));
Try %V
http://www.cplusplus.com/reference/ctime/strftime/
The reference shows %W is Week number with the first Monday as the first day of week one (00-53) while %V is the ISO 8601 week number (01-53)
It’s no good stating something is wrong before checking whether we may have applied it incorrectly
BTW, as mentioned multiple times before, when applying Time.format()
(or any other Time
method) to the current time, it’s preferable to use it like this
Time.format("KW: %V");
That should be correct. The strftime
docs for the %W
specifier say: Week number with the first Monday as the first day of week one (00-53)
. Since Jan 1, 2019 fell on a Tuesday, we are currently in week zero. On Monday Jan 7, it will be week one.
Oha, that there are so many formatting-specific, I had not thought.
I had really come from a wrong conclusion. With %V fits that back to my excel
Thanks!