Re: coercing text to time
Re: coercing text to time
- Subject: Re: coercing text to time
- From: Robert Poland <email@hidden>
- Date: Wed, 19 Oct 2005 16:11:53 -0600
At 2:38 PM -0600 10/19/05, Robert Poland wrote:
Gets error "Can't get time string of
"0.489583333333", it should be 11:45(AM). Isn't
there a simple way to do this?
Simple, depends on your personal scale.
First convert the fraction of a day into a count of seconds:
set theSeconds to testData * 86400 -- seconds per day
Now, add that to any date where the time is
12:00AM, one of the shortest is date ("" & 1):
set theDate to (date ("" & 1)) + theSeconds
*Now* take the time string (time string is a
property of dates only), which gives:
if testData "" then
set theSeconds to 86400 * testData -- seconds per day
set theDate to (date ("" & 1)) + theSeconds -- force portability
set testData to time string of theDate
end if
Emmanuel
This inside a Tell block fails
tell application "Microsoft Excel"
set theDate to (date ("" & 1))
end tell
"Can't get date of "1"."
--
Bob Poland - Fort Collins, CO
http://www.ibrb.org/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden