>This is my last whack at it.. there's definitely got to be a better >way. But these seems to work. >Just specify your month, day & year in the first few lines... > >on mouseup > put the seconds into nowSecs > put "12" into theMonth > put "31" into theDay > put "2002" into theYear > put "no" into leapThisYear > if "." is not in theYear/4 then > put "yes" into leapThisYear > if "." is in theYear/100 then > put "no" into leapThisYear > if "." is not in theYear/2000 then > put "yes" into leapThisYear > end if > end if > end if > if theMonth>01 then add 31 to dayCount > if theMonth>02 then add 28 to dayCount > if leapThisYear="yes" then add 1 to dayCount > if theMonth>03 then add 31 to dayCount > if theMonth>04 then add 30 to dayCount > if theMonth>05 then add 31 to dayCount > if theMonth>06 then add 30 to dayCount > if theMonth>07 then add 31 to dayCount > if theMonth>08 then add 31 to dayCount > if theMonth>09 then add 30 to dayCount > if theMonth>10 then add 31 to dayCount > if theMonth>11 then add 30 to dayCount > set itemDelimiter to "/" > add theDay to dayCount > put dayCount*24*60*60 into furtherSecsThisYear > > put 0 into totalSecs > > put 1969 into sYr > repeat > add 1 to sYr > if sYr=theYear 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 (totalSecs+furtherSecsThisYear)-totalSecs into netSecsThisYr > > put netSecsThisYr/60/60/24/7 into netWeek > > set itemDelimiter to "." > put item 1 of netWeek into thisWeek > answer thisWeek > >end mouseup > >
Fine, it does just what I want. I made a fuction of your code BUT for an european date : "DD/MM/YYYY" it can easily be adapted for an other format of date. there was a previous discussion in the list about the date format One may take the code of this date format to adapt the function in an international format function WeekNr theDate set itemdelimiter to "/" put item 1 of theDate into theDay put item 2 of theDate into theMonth put item 3 of theDate into theYear set itemdelimiter to comma --put "12" into theMonth --put "31" into theDay --put "2002" into theYear put "no" into leapThisYear if "." is not in theYear/4 then put "yes" into leapThisYear if "." is in theYear/100 then put "no" into leapThisYear if "." is not in theYear/2000 then put "yes" into leapThisYear end if end if end if if theMonth>01 then add 31 to dayCount if theMonth>02 then add 28 to dayCount if leapThisYear="yes" then add 1 to dayCount if theMonth>03 then add 31 to dayCount if theMonth>04 then add 30 to dayCount if theMonth>05 then add 31 to dayCount if theMonth>06 then add 30 to dayCount if theMonth>07 then add 31 to dayCount if theMonth>08 then add 31 to dayCount if theMonth>09 then add 30 to dayCount if theMonth>10 then add 31 to dayCount if theMonth>11 then add 30 to dayCount set itemDelimiter to "/" add theDay to dayCount put dayCount*24*60*60 into furtherSecsThisYear put 0 into totalSecs put 1969 into sYr repeat add 1 to sYr if sYr=theYear 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 (totalSecs+furtherSecsThisYear)-totalSecs into netSecsThisYr put netSecsThisYr/60/60/24/7 into netWeek set itemDelimiter to "." put item 1 of netWeek into thisWeek add "1" to thisWeek return thisWeek end WeekNr -- _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution