• 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: Human Readable Time snipit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Human Readable Time snipit


  • Subject: Re: Human Readable Time snipit
  • From: "Nigel Garvey" <email@hidden>
  • Date: Sat, 14 Oct 2006 19:04:18 +0100

Martin Orpen wrote on Sat, 14 Oct 2006 11:55:24 +0100:

>Or, for a more "human readable" result you could the
>onCalendarInterval handler that Nigel posted in response to a problem
>that I was having working out the intervals between iCal events many E
>+ seconds ago:
>
>------------
>
>set startTime to date "Friday, January 1, 1904 00:00:00" -- trad Apple
>set finishTime to startTime + 5.86574625E+8
>
>set foo to calendarInterval(finishTime, startTime)
[snip]
>--> 18 yr 7 mth 2 dy 1 hr 23 min 45 sec

Unfortunately, the number of months and years depends on when you start.
The fixed intervals larger than a day are the week and the Gregorian
cycle.  :)

  on GwdhmsFormat(s)
    (s div 1.26227808E+10 as string) & " Gr " & s mod 1.26227808E+10 div
weeks & " wk " & s mod weeks div days & " dy " & s mod days div hours & "
hr " & s mod hours div minutes & " min " & s mod minutes div 1 & " sec"
  end GwdhmsFormat

  GwdhmsFormat(5.86574625E+8)
  --> "0 Gr 969 wk 6 dy 1 hr 23 min 45 sec"

NG

 _______________________________________________
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: Human Readable Time snipit
      • From: Martin Orpen <email@hidden>
  • Prev by Date: Re: ISO date format on SOAP interface
  • Next by Date: Re: ISO date format on SOAP interface
  • Previous by thread: Re: Human Readable Time snipit
  • Next by thread: Re: Human Readable Time snipit
  • Index(es):
    • Date
    • Thread