Week number

David Kwinter dk42 at mac.com
Sat Apr 13 15:34:01 EDT 2002


This is a pretty abstract way of going about it but I think it works. 
Check it for bugs, I wrote it up in a few minutes..

on mouseup
   put 0 into totalSecs
   put word 4 of the long date into yr
   put 1969 into sYr
   repeat
     add 1 to sYr
     if sYr=yr then exit repeat
     put "no" into leapYear
     if "." is not in sYr/4 then
       put "yes" into leapYear
       if "." is in sYr/100 then
         put "no" into leapYear
         if "." is not in sYr/2000 then
           put "yes" into leapYear
         end if
       end if
     end if

     if leapYear="no" then put 365 into daysThisYear
     else put 366 into daysThisYear
     add daysThisYear*60*60*24 to totalSecs

   end repeat
   put the seconds-totalSecs into netSecsThisYr

   put netSecsThisYr/60/60/24/7 into netWeek

   set itemDelimiter to "."
   put item 1 of netWeek into thisWeek
   answer "This week is #"&thisWeek&" of the year!"

end mouseup




On Saturday, April 13, 2002, at 04:12 PM, yves COPPE wrote:

> Hi,
>
>
> I'd like something not so difficult (I hope so) :
>
> How to calculate the week number of a date
>
> So, we are today 04/13/2002 (13/04/2002 in Europe).
>
> We are week number 15
>
> I'd like a script which calculates this number : "15" for a given date 
> (today)
>
> Thanks.
> -- Greetings.
>
> Yves COPPE
>
> Email : yvescoppe at skynet.be
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list