• 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: Getting the time zone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the time zone


  • Subject: Re: Getting the time zone
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 13 Dec 2007 20:24:18 -0500

It follows that you can get the time zone via

do shell script "date +%z"

but I don't know if there's an AppleScript-native solution.


On Dec 13, 2007 8:22 PM, Mark J. Reed < email@hidden> wrote:
On Dec 13, 2007 8:09 PM, Rob Lewis <email@hidden> wrote:
How can you get the computer's time zone setting in a script?

Good question, since IIRC, pre-OS-X the Mac OS didn't have a concept of time zone. 


Also, I've seen a date/time format in XMP metadata like this:

2007-12-14T17:55:38-08:00

Where the letter "T" seems to separate the date from the time, and
the time zone offset is tacked onto the end.

Is this a standard format?

Yes.  Specifically, part of ISO 8601.
 
Is it directly supported in AppleScript?

AppleScript just uses whatever you have set in your preference pane.  You can certainly set things up to display dates in that format, in which case AS's conversion to strings will honor that setting.
 

Shell script?

The format string  used by the strftme library routine, and therefore the "date" command, has shortcuts for the components:

date +%FT%T%z

Where %F is equivalent to %Y-%m-%d and %T is equivalent to %H:%M:%S, and  %z is the timezone offset.

--
Mark J. Reed < email@hidden >



--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Getting the time zone
      • From: Stan Cleveland <email@hidden>
    • Re: Getting the time zone
      • From: Paul Berkowitz <email@hidden>
References: 
 >Getting the time zone (From: Rob Lewis <email@hidden>)
 >Re: Getting the time zone (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Getting the time zone
  • Next by Date: Re: Getting the time zone
  • Previous by thread: Re: Getting the time zone
  • Next by thread: Re: Getting the time zone
  • Index(es):
    • Date
    • Thread