<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Date-/Time-Calculations using AppleScript</title>
	<atom:link href="http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/</link>
	<description>Things I'm working on, not necessarily functioning yet.</description>
	<lastBuildDate>Sat, 02 Apr 2011 22:40:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Report the time in another city with Applescript — KnowIT</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-105</link>
		<dc:creator>Report the time in another city with Applescript — KnowIT</dc:creator>
		<pubDate>Sat, 05 Mar 2011 00:49:46 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-105</guid>
		<description>[...] trying to subtract numbers from the date in the script I eventually found help at Erik&#8217;s Lab: Date-/Time-Calculations using AppleScript. That gave me the very simple 2 lines I needed to subtract 20 hours from my time to get Santa [...]</description>
		<content:encoded><![CDATA[<p>[...] trying to subtract numbers from the date in the script I eventually found help at Erik&#8217;s Lab: Date-/Time-Calculations using AppleScript. That gave me the very simple 2 lines I needed to subtract 20 hours from my time to get Santa [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-101</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Mon, 21 Feb 2011 08:48:34 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-101</guid>
		<description>You seem to be living in a &lt;em&gt;DDMMYY&lt;/em&gt; locale, meaning your solution will work for people living in such a locale. In the US the short date string looks like this &lt;em&gt;MMDDYY&lt;/em&gt;, so it wouldn&#039;t work as expected or worse, result in a wrong value going unnoticed.

One should always be on the lookout for such problems and circumvent them by being as locale-agnostic as possible. ;-)</description>
		<content:encoded><![CDATA[<p>You seem to be living in a <em>DDMMYY</em> locale, meaning your solution will work for people living in such a locale. In the US the short date string looks like this <em>MMDDYY</em>, so it wouldn&#8217;t work as expected or worse, result in a wrong value going unnoticed.</p>
<p>One should always be on the lookout for such problems and circumvent them by being as locale-agnostic as possible. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wesley Konrad</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-100</link>
		<dc:creator>Wesley Konrad</dc:creator>
		<pubDate>Mon, 21 Feb 2011 01:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-100</guid>
		<description>I came up with a faster solution to return the month as an integer

set bob to current date
set intMonth to  (word 2 of (short date string of bob)) as integer

Although this will only work depending on how the text item delimiters are set.</description>
		<content:encoded><![CDATA[<p>I came up with a faster solution to return the month as an integer</p>
<p>set bob to current date<br />
set intMonth to  (word 2 of (short date string of bob)) as integer</p>
<p>Although this will only work depending on how the text item delimiters are set.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-88</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Thu, 02 Jul 2009 07:33:12 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-88</guid>
		<description>Scott, let me think about this. There are a couple of solutions popping into my head right now. I&#039;ll write a post about the subject.</description>
		<content:encoded><![CDATA[<p>Scott, let me think about this. There are a couple of solutions popping into my head right now. I&#8217;ll write a post about the subject.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-87</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Tue, 30 Jun 2009 20:34:59 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-87</guid>
		<description>so I&#039;m trying to write and applescript to compare the create and modified time stamps of a file 
so I&#039;m talking about a format like
2009-03-09 18:03:47 -0400
and
2009-03-09 15:03:47 -0700

which are for all intents and purposes are equal, but apple script wont let me cast them as date type.  are there any built-ins or tricks for evaluating this kind of format with applescript or even the date command from a terminal?

thanks</description>
		<content:encoded><![CDATA[<p>so I&#8217;m trying to write and applescript to compare the create and modified time stamps of a file<br />
so I&#8217;m talking about a format like<br />
2009-03-09 18:03:47 -0400<br />
and<br />
2009-03-09 15:03:47 -0700</p>
<p>which are for all intents and purposes are equal, but apple script wont let me cast them as date type.  are there any built-ins or tricks for evaluating this kind of format with applescript or even the date command from a terminal?</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stib</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-83</link>
		<dc:creator>stib</dc:creator>
		<pubDate>Wed, 14 Jan 2009 02:11:51 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-83</guid>
		<description>per:
set mM to (month of (current date)) as integer
will do it</description>
		<content:encoded><![CDATA[<p>per:<br />
set mM to (month of (current date)) as integer<br />
will do it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stib</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-82</link>
		<dc:creator>stib</dc:creator>
		<pubDate>Wed, 14 Jan 2009 01:29:25 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-82</guid>
		<description>Oh I got it. I had the shell scripts in a subroutine and was doing
 on readdate()
  set lastopen to do shell script (”defaults read org.pureandapplied.startupscript ‘lastopen’”)
  return lastopen
 end

But for some reason the subroutine doesn&#039;t get evaluated as a date. If I force it to return a date it works, so I use
 return date lastopen
not 
 return lastopen</description>
		<content:encoded><![CDATA[<p>Oh I got it. I had the shell scripts in a subroutine and was doing<br />
 on readdate()<br />
  set lastopen to do shell script (”defaults read org.pureandapplied.startupscript ‘lastopen’”)<br />
  return lastopen<br />
 end</p>
<p>But for some reason the subroutine doesn&#8217;t get evaluated as a date. If I force it to return a date it works, so I use<br />
 return date lastopen<br />
not<br />
 return lastopen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stib</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-81</link>
		<dc:creator>stib</dc:creator>
		<pubDate>Wed, 14 Jan 2009 01:23:48 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-81</guid>
		<description>I even tried adding the -date switch to the defaults command, but it seems to use a different format</description>
		<content:encoded><![CDATA[<p>I even tried adding the -date switch to the defaults command, but it seems to use a different format</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stib</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-80</link>
		<dc:creator>stib</dc:creator>
		<pubDate>Wed, 14 Jan 2009 01:14:30 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-80</guid>
		<description>I&#039;m trying to write a simple app for my start up folder that checks to see whether this is the first time I&#039;ve booted up today so it can open stuff that I need when I first get in to work, but which I don&#039;t want to see if I restart during the day.

I do it by getting the app to store the last login date in my preferences, and compare the last login with today. But If I do

do shell script (&quot;defaults write org.pureandapplied.startupscript &#039;lastopen&#039; &#039;&quot; &amp; (current date) &amp; &quot;&#039;&quot;)
set lastopen to do shell script (&quot;defaults read org.pureandapplied.startupscript &#039;lastopen&#039;&quot;)
day of lastopen

it doesn&#039;t treat the value returned as a date:
&quot;Can&#039;t make \&quot;Wednesday, 14 January 2009 12:05:29 PM\&quot; into type date.&quot;

I can do it with text munging, or by checking the modification date on a file, but that&#039;s nowhere near as elegant.</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to write a simple app for my start up folder that checks to see whether this is the first time I&#8217;ve booted up today so it can open stuff that I need when I first get in to work, but which I don&#8217;t want to see if I restart during the day.</p>
<p>I do it by getting the app to store the last login date in my preferences, and compare the last login with today. But If I do</p>
<p>do shell script (&#8220;defaults write org.pureandapplied.startupscript &#8216;lastopen&#8217; &#8216;&#8221; &amp; (current date) &amp; &#8220;&#8216;&#8221;)<br />
set lastopen to do shell script (&#8220;defaults read org.pureandapplied.startupscript &#8216;lastopen&#8217;&#8221;)<br />
day of lastopen</p>
<p>it doesn&#8217;t treat the value returned as a date:<br />
&#8220;Can&#8217;t make \&#8221;Wednesday, 14 January 2009 12:05:29 PM\&#8221; into type date.&#8221;</p>
<p>I can do it with text munging, or by checking the modification date on a file, but that&#8217;s nowhere near as elegant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew</title>
		<link>http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/comment-page-1/#comment-79</link>
		<dc:creator>Drew</dc:creator>
		<pubDate>Wed, 03 Dec 2008 16:06:39 +0000</pubDate>
		<guid isPermaLink="false">http://erikslab.com/2007/11/26/date-time-calculations-using-applescript/#comment-79</guid>
		<description>What if I wanted to get a date in this format: &quot;2008-12-02 16:03:45.180&quot;?</description>
		<content:encoded><![CDATA[<p>What if I wanted to get a date in this format: &#8220;2008-12-02 16:03:45.180&#8243;?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

