For Programmers: Free Programming Magazines  


Home > Archive > Tcl > November 2006 > Re: proc needs to always calculate the following Saturday but fails









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: proc needs to always calculate the following Saturday but fails
Kevin Kenny

2006-11-24, 7:02 pm

comp.lang.tcl wrote:
> I've tried for years to get this to be accurate and fail every time;
> can someone please help me with this? I need to always get the next
> immediate following Saturday.


Uhm, does [clock scan Saturday] do what you want? Or if you need
the next Saturday after a given date,

[clock scan Saturday -base [clock scan $date]]

I'm not quite following the Tcl code that you posted, but suspect
that you're trying to reinvent one of the idioms above.

--
73 de ke9tv/2, Kevin
Kevin Kenny

2006-11-24, 7:02 pm

comp.lang.tcl wrote:
>
> Problem is that it has to also be the next Saturday from the last
> previous value of $expDate, so that if the very last value in the XML
> row points to the date being 11/25/2006, the next one must be
> 12/2/2006, however, if the last one is 12/2/2006, the next one after
> that must be 12/9/2006 and so on and so on


Oh, ok, so add a day to your -base:

set expTime [clock scan $expDate]
set expTimeTomorrow [clock scan tomorrow -base $expTime]
set expTimeSaturday [clock scan Saturday -base $expTimeTomorrow]
puts [clock format $expTimeSaturday]

--
73 de ke9tv/2, Kevin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com