RE: Date of next Thursday
RE: Date of next Thursday
- Subject: RE: Date of next Thursday
- From: Mattias Jonsson <email@hidden>
- Date: Wed, 15 Nov 2000 19:13:02 +0100
>
Is there an easy method to get the date of next Thursday in a script
>
without a lot of if/thens?
>
>
I'm working on a script to change folio dates in Xpress templates,
>
and rather than relying on a user to enter the correct date, I'd like
>
to be able to have the script say, in essence, "If (current date) is
>
Friday, December 29, 2000 then next Thursday will be January 4, 2001"
>
store that into a variable so I can extract the info I need.
>
>
>
Haven't managed to do it without the "if's" and "then's", but it works and
it doesn't take up much of your time.
The one below (slightly modified) works for me.
--------- SNIP---------
set TodayDay to weekday of (current date) as string
if TodayDay is "Thursday" then
set InBetween to 1
else if TodayDay is "Monday" then
set InBetween to 3
else if TodayDay is "Tuesday" then
set InBetween to 2
else if TodayDay is "Wednesday" then
set InBetween to 1
else if TodayDay is "Friday" then
set InBetween to 6
else if TodayDay is "Saturday" then
set InBetween to 5
else if TodayDay is "Sunday" then
set InBetween to 4
end if
set nextThursday to ((current date) + (InBetween * 86400))
display dialog nextThursday as string
--------- SNIP---------
HTH
/Mattias Jonsson
__________________________________
FRAMKOM, "Forskningsaktiebolaget
Medie- och Kommunikationsteknik"
Avdelningen fvr "Informationshantering
och Publiceringsformer"
Box 5637, SE 114 86 Stockholm
Drottning Kristinas Vdg 51
Tel: 08-453 57 02 (00)
Fax: 08-453 57 57
Mobil: 070-777 28 68
mailto:email@hidden
http://www.framkom.se/