Re: Summary: Applescript can't tell time?
Re: Summary: Applescript can't tell time?
- Subject: Re: Summary: Applescript can't tell time?
- From: Emmanuel <email@hidden>
- Date: Wed, 4 Feb 2004 10:42:11 +0100
At 2:35 PM +1100 04-02-04, Malcolm Fitzgerald wrote:
>
At 4:42 PM -0800 3/2/04, Andrew Oliver wrote:
>
>How about:
>
>
>
>(current date) - (date "Thursday, January 1, 1970 12:00:00 AM")
>
>
>
>--> 1.075826495E+9
>
>
>
>
It looks like Andrew posted a compiled line of code. Short forms of the date work equally well.
You are right, but then you make assumptions regarding the user's settings: if you change your System Preferences > International > Date settings to "Year-Month-Day",
------------------
set s to "1/1/1970"
date s --> Invalid blah blah
------------------
Of course, if the OS is not set to the English or an English-based language, date "Thursday, whatever" will fail also.
Finally, I don't know another way of getting a given date without making assumptions on the user's language nor settings (except resorting to do shell script) than:
------------------
set d to current date
set day of d to 1
set month of d to January
set year of d to 1970
set time of d to 0
------------------
(If AppleScript implemented AppleScript, you could say "set properties of d to {day:1, ...}" but this upsets poor lil' stack)
Emmanuel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.