Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lazy question on clock func !

7 views
Skip to first unread message

Mel

unread,
Oct 21, 2008, 2:56:50 PM10/21/08
to
puts [clock format [clock seconds] -format %W]

tells me the week no in a year with start week day as Monday.

My question : I need dates that start with (say) week 10 and end with
week(14) of a given year.

How can I get this information from clock function ?

thanks for your help

Glenn Jackman

unread,
Oct 21, 2008, 3:31:21 PM10/21/08
to

using the new time scanning in Tcl 8.5, you need to specify the year,
week of year and day of week:

set wk10monday [clock scan {2008 1 10} -format {%G %w %V}]
set wk14friday [clock scan {2008 5 14} -format {%G %w %V}]
puts "starting [clock format $wk10monday]"
puts "ending [clock format $wk14friday]"

results in:

starting Mon Mar 03 00:00:00 EST 2008
ending Fri Apr 04 00:00:00 EDT 2008

See point [3] under http://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm#M25

If you're using Tcl 8.4, get the clock extension from
http://sourceforge.net/project/showfiles.php?group_id=10894

(release notes: http://sourceforge.net/project/shownotes.php?release_id=505712)

--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous

Glenn Jackman

unread,
Oct 21, 2008, 3:34:53 PM10/21/08
to
At 2008-10-21 03:31PM, "Glenn Jackman" wrote:
> using the new time scanning in Tcl 8.5, you need to specify the year,
> week of year and day of week:
[...]

Ah, I see points [4] and [5] say that you can use a 2-digit year or no
year at all. But you do need to specify the week of year and day of
week at minimum.

0 new messages