• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: easy one: current date in Paris
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: easy one: current date in Paris
      • From: kai <email@hidden>
References: 
 >easy one: current date in Paris (From: jj <email@hidden>)

  • Prev by Date: Re: easy one: current date in Paris
  • Next by Date: Re: easy one: current date in Paris
  • Previous by thread: Re: easy one: current date in Paris
  • Next by thread: Re: easy one: current date in Paris
  • Index(es):
    • Date
    • Thread