• 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: time to gmt
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: time to gmt


  • Subject: Re: time to gmt
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 14 Mar 2007 23:07:28 -0400

On 3/14/07, Michelle Steiner <email@hidden> wrote:
You're in an area where daylight time is in effect, so if the date
you're converting is not during daylight time, you'll be an hour
off.

The problem is that "time to gmt" is a constant; what is needed is a function that calculates the offset for the time in question rather than right now.

Well, you can use Perl...

do shell script "perl -MTime::Local -MPOSIX -e 'print strftime("%d%b%y
%I:%M%p%Z", localtime(timegm(0,0,10,1,0,2007)))'"

--> 01Jan07 05:00AMEST

The tricky bit there is parsing the date into the arguments to timegm
(sec, min, hour, date, month (0=Jan through 11=Dec), year).  (You can
use the Time::ParseDate module to convert a string representation, but
that module's not bundled).


-- 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
References: 
 >time to gmt (From: tom wible <email@hidden>)
 >Re: time to gmt (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: time to gmt
  • Next by Date: Re: Encoded file URL to Mac or Posix path...
  • Previous by thread: Re: time to gmt
  • Next by thread: Microsoft: the experts in crazy-making
  • Index(es):
    • Date
    • Thread