• 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: Milliseconds to "formatted time"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Milliseconds to "formatted time"


  • Subject: Re: Milliseconds to "formatted time"
  • From: jj <email@hidden>
  • Date: Sat, 16 Jul 2005 10:15:36 +0200

> Before re-inventing the wheel, there is a quick (or fast) and vanilla
> solution to convert milliseconds to a formatted time string? Eg:

Well, here is a sample supporting 24-hours formatting:

millisecToFormattedTime(4806790) --> "01:20:06.790"

to millisecToFormattedTime(tMs)
    set finalHours to tMs div 3600000
    set remMS to tMs mod 3600000

    set finalMins to remMS div 60000
    set remMS to remMS mod 60000

    set finalSecs to remMS div 1000
    set remMS to remMS mod 1000

    return "" & (text -2 thru -1 of ("00" & finalHours)) & ":" & (text -2
thru -1 of ("00" & finalMins)) & ":" & (text -2 thru -1 of ("00" &
finalSecs)) & "." & (text -3 thru -1 of ("00" & remMS))
end millisecToFormattedTime


jj

--
http://www.macscripter.net/
http://www.osaxen.com/


 _______________________________________________
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

References: 
 >Milliseconds to "formatted time" (From: jj <email@hidden>)

  • Prev by Date: Re: what happened to Mail's scripts menu?
  • Next by Date: Re: what happened to Mail's scripts menu?
  • Previous by thread: Milliseconds to "formatted time"
  • Next by thread: Re: Milliseconds to "formatted time"
  • Index(es):
    • Date
    • Thread