• 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: new (I think) time question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new (I think) time question


  • Subject: Re: new (I think) time question
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 6 Sep 2009 21:13:10 +0200


Le 6 sept. 2009 à 20:53:11, Deivy Marck Petrescu a écrit :


On Sep 6, 2009, at 13:28, Yvan KOENIG wrote:

set wakeTime to "6:01"
set WakeUpTime to short date string of (current date)
set WakeUpTime to date (WakeUpTime & space & wakeTime)
display dialog (time of WakeUpTime) as text



Try this instead:


set wakeTime to "6:01"
set WakeUpTime to short date string of (current date)
set WakeUpTime to date (WakeUpTime & space & wakeTime)

set pad to "0"
set h to (time of WakeUpTime) div (1 * hours)
if h < 10 then set h to pad & h
set m to ((time of WakeUpTime) mod (1 * hours)) div (1 * minutes)
if m < 10 then set m to pad & m
set s to (time of WakeUpTime) mod (1 * hours) mod (1 * minutes)
if s < 10 then set s to pad & s

display dialog (h & ":" & m & ":" & s)





Deivy Petrescu

Thanks Deivy.

I had no problem with the deciphering of the numerical time.
What I don't understand is why I get the value 21660
when Robert Poland get 0.
But maybe, he was just saying that my code was not fitting its needs.

Given your code, I guess that you get also 21660

To do this kind of conversion, I'm acustomed to this kind of code:

set wakeTime to "6:01"
set WakeUpTime to short date string of (current date)
set WakeUpTime to date (WakeUpTime & space & wakeTime)

set pad to "0"
set h to text -2 thru -1 of ("00" & (time of WakeUpTime) div (1 * hours))
set m to text -2 thru -1 of ("00" & ((time of WakeUpTime) mod (1 * hours)) div (1 * minutes))
set s to text -2 thru -1 of ("00" & ((time of WakeUpTime) mod (1 * hours) mod (1 * minutes)))

display dialog (h & ":" & m & ":" & s)

Yvan KOENIG (VALLAURIS, France) dimanche 6 septembre 2009 21:13:06


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >new (I think) time question (From: Robert Poland <email@hidden>)
 >Re: new (I think) time question (From: Yvan KOENIG <email@hidden>)
 >Re: new (I think) time question (From: Robert Poland <email@hidden>)
 >Re: new (I think) time question (From: Yvan KOENIG <email@hidden>)
 >Re: new (I think) time question (From: Deivy Marck Petrescu <email@hidden>)

  • Prev by Date: Re: new (I think) time question
  • Next by Date: Re: new (I think) time question
  • Previous by thread: Re: new (I think) time question
  • Next by thread: Accessing front window of Mail.app
  • Index(es):
    • Date
    • Thread