Hi lemodizon,
this does what you want for 1 target day, modify it for 2
The nice thing about dateItems is that you can put any number into the items and it will convert it to the correct date.
What is the date in 250 days from today:Kind regards
Bernd
this does what you want for 1 target day, modify it for 2
CODE:
on mouseUp put the short date into tConvertDate put tConvertDate into fld "CurrentDate" put tConvertDate into tStart put 15 into tDayOfMonth convert tConvertDate to dateitems put tConvertDate into tFirstTargetDay if item 3 of tConvertDate > tDayOfMonth then -- we are beyond the targetDay add 1 to item 2 of tFirstTargetDay -- go next month put tDayOfMonth into item 3 of tFirstTargetDay -- set day in next month else -- we are before or at the targetDay put tDayOfMonth into item 3 of tFirstTargetDay end if put 12 into item 4 of tConvertDate put 12 into item 4 of tFirstTargetDay convert tConvertDate from dateItems to seconds convert tFirstTargetDay from dateItems to seconds put tFirstTargetDay - tConvertDate into tDiff convert tFirstTargetDay from seconds to dateItems convert tFirstTargetDay from dateItems to short date answer tDiff / (60 * 60 * 24) && "days until" && tFirstTargetDayend mouseUp
What is the date in 250 days from today:
CODE:
on mouseUp put the short date into tToday convert tToday to dateItems add 250 to item 3 of tToday convert tToday from dateItems to short date answer tToday && "date 250 days from today"end mouseUp
Bernd
Statistics: Posted by bn — Sun May 26, 2024 4:53 pm