Re: easy one: current date in Paris
Re: easy one: current date in Paris
- Subject: Re: easy one: current date in Paris
- From: Michelle Steiner <email@hidden>
- Date: Tue, 5 Jul 2005 14:22:05 -0700
On Jul 5, 2005, at 1:43 PM, jj wrote:
set currentDateInParis to (current date) - (time to GMT) + (1 * 3600)
I'd write it as set currentDateInParis to (current date) - (time to
GMT) + (1 * hours)
Assuming that the time in Paris is one hour earlier than GMT.
Here is a generalized solution (that does not take daylight savings
time into account):
set timezones to {{"paris", 1}, {"new york", -5}, {"los angeles", -8}}
set city to first item of (choose from list {"paris", "new york",
"los angeles"} with prompt "What city's time do you wish?")
repeat with pair in timezones
if first item of pair is city then
set the_offset to item 2 of contents of pair
exit repeat
end if
end repeat
set currentdate to (current date) - (time to GMT) + (the_offset * hours)
Can anyone figure out how to avoid the repeat loop?
-- Michelle
--
"You can fool some of the people all of the time and those are the
ones you want to concentrate on."
- George W. Bush at the Gridiron Dinner, Washington, DC March 31, 2001
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden