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

Re: coercing text to time


  • Subject: Re: coercing text to time
  • From: Emmanuel <email@hidden>
  • Date: Wed, 19 Oct 2005 23:30:56 +0200

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

_______________________________________________
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


  • Follow-Ups:
    • Re: coercing text to time
      • From: Robert Poland <email@hidden>
References: 
 >coercing text to time (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Days and hours
  • Next by Date: Folders within folders
  • Previous by thread: coercing text to time
  • Next by thread: Re: coercing text to time
  • Index(es):
    • Date
    • Thread