Week number
yves COPPE
yvescoppe at skynet.be
Sat Apr 13 16:02: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
>
Fine !
But how to proceed for another date than today.
What's the number of the week for another given date ?
thanks.
--
Greetings.
Yves COPPE
Email : yvescoppe at skynet.be
More information about the use-livecode
mailing list