Skip to content
Tcl Source Code View Ticket
Login

View Ticket

clock format - wrong ISO8601 week number

Closed / Fixed500285ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 23 years ago
Descriptionplain2002-01-07 06:45:47
Hello!

clock format [clock seconds] -format "%W"

returns 1 for 2002-01-07 (today), although the
first week of 2002 lasted from 2001-12-31 to
2002-02-06.

The first week of a year is the one with the
majority of days in it. Or, resulting the same,
the first week with a thursday in it, is week
number 1.

So, 2002-01-03 was a thursday, so that week is
week number 1.

Sincerely

Holger Jakobs, [email protected]
kennykbplain2002-01-07 22:43:01
Logged In: YES 
user_id=99768

The format group for an ISO-8601 fiscal week is %V, not %W.  Alas, there is no corresponding format group 
for the year to return '2002' on 2001-12-31.  %V is inexplicably not in the documentation for Tcl 8.3; this 
problem is corrected in 8.4.
kennykbplain2002-01-12 08:01:17
Logged In: YES 
user_id=99768

On the CVS head of the tcllib project, there is now
a 'modules/calendar' directory that includes Tcl functions
for converting among several calendar representations -- including
ISO fiscal year and week.  Please check
it out!
kennykbplain2004-03-06 00:31:26
Logged In: YES 
user_id=99768

This is a bug in compat/strftime.c  but the platform-native
one is even worse.  I've a reimplementation of [clock format]
in my sandbox that eliminates the dependency on this function.
kennykb Open ticket [500285ffff]. [History diff]2004-05-19 03:31:32
kennykb Ticket [500285ffff]: 1 change [History diff]2004-05-19 03:40:49
kennykb Closed ticket [500285ffff]. [History diff]2004-05-19 04:53:46
kennykb Ticket [500285ffff]: 3 changes [History diff]2004-05-19 04:53:47
Log in (anonymous is fine) to add a comment.