• 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: Issues subtracting Unix epoch from date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues subtracting Unix epoch from date


  • Subject: Re: Issues subtracting Unix epoch from date
  • From: Deivy Petrescu <email@hidden>
  • Date: Sat, 20 Feb 2010 19:12:58 -0500

On Feb 20, 2010, at 6:06 PM, Nathan Vander Wilt wrote:

> On Feb 20, 2010, at 2:51 PM, Nathan Vander Wilt wrote:
>> Here's an equivalent to what I need to do:
>>
>> 1. Get a date from an application (e.g. tell application "iPhoto" to get date of some photo)
>> 2. Store a representation to disk, then exit script
>> 3. Time passes, time zone offset may change.
>> 4. Start script, load stored representation from disk
>> 5. Set the *same* date (or a precise adjustment thereof) back to the application
>>
>> This is impossible to do with AppleScript's date model. (Or please show how I am wrong?)
>
>
> -- Heh heh heh
> copy (current date) to theDate
> tell application "System Events"
> 	local thePlist, theXML
> 	make new property list item with properties {value:theDate}
> 	set thePlist to text of result
> 	make new XML data with properties {text:thePlist}
> 	set theXML to result
> 	get the first XML element of the first XML element of theXML
> 	get value of result
> end tell
>
>
> This is pretty much ridiculous, but it does have the side effect of working. I haven't implemented it yet, but I'm presuming the reverse direction is possible as well. I am considering writing a faceless scriptable Cocoa app to do a more efficient conversion (and one that doesn't rely on a property list item's text to always be XML), but that may be a bit of a pain to deploy.
>
> hope this helps,
> -natevw _______________________________________________


Nate,
 you can substitute the code above by

return ((current date) - (time to GMT)) as «class isot» as string


Can't guarantee it will not break in the future.



Deivy Petrescu
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: Issues subtracting Unix epoch from date
      • From: Nathan Vander Wilt <email@hidden>
References: 
 >Issues subtracting Unix epoch from date (From: Nathan Vander Wilt <email@hidden>)
 >Re: Issues subtracting Unix epoch from date (From: "Mark J. Reed" <email@hidden>)
 >Re: Issues subtracting Unix epoch from date (From: Nathan Vander Wilt <email@hidden>)
 >Re: Issues subtracting Unix epoch from date (From: "Mark J. Reed" <email@hidden>)
 >Re: Issues subtracting Unix epoch from date (From: Nathan Vander Wilt <email@hidden>)
 >Re: Issues subtracting Unix epoch from date (From: Nathan Vander Wilt <email@hidden>)

  • Prev by Date: Re: Issues subtracting Unix epoch from date
  • Next by Date: Re: Issues subtracting Unix epoch from date
  • Previous by thread: Re: Issues subtracting Unix epoch from date
  • Next by thread: Re: Issues subtracting Unix epoch from date
  • Index(es):
    • Date
    • Thread