• 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: Robert Poland <email@hidden>
  • Date: Mon, 7 Sep 2009 06:18:06 -0600

Ed,

I think you missed the point here.

My machine doesn't get military time here regardless of the Date & Time settings.


On Sep 7, 2009, at 1:13 AM, email@hidden wrote:

That is a static number. The only purpose for getting the afternoonTime variable is to determine if the time is set to military time. If it is then the time string would contain "13" when the time is 1 pm.

On Sep 6, 2009, at 17:40 PM, Robert Poland wrote:

Ed, This might be a clue;

set AppleScript's text item delimiters to ""
set wakeTime to "21:01"
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":", " "}
set {wakeHour, wakeMin} to text items of wakeTime
set AppleScript's text item delimiters to oldDelims
set h to wakeHour as integer
if h < 13 then
set amOrPm to " am"
else
set amOrPm to " pm"
set afterNoonTime to "1:00 pm"
set t to (date afterNoonTime) as string
display dialog t
--> Sunday, September 6, 2009 1:00:00 PM 
if time string of date afterNoonTime contains "13" then set h to h - 12
end if
set m to wakeMin as integer
if m < 10 then set m to "0" & m
set wakeTime to (h & ":" & m & amOrPm)
set WakeUpTime to short date string of (current date)
set WakeUpTime to date (WakeUpTime & space & wakeTime)
(time string of WakeUpTime)
display dialog WakeUpTime as string
--> Monday, September 7, 2009 9:01:00 PM 
return

NOTE the first display dialog yields 1:00:00 PM regardless of the setting of the 24h clock.


On Sep 6, 2009, at 4:50 PM, email@hidden wrote:

Hmmm,  It works for me 12 or 24.  

Are you certain your date is set for Sept. 6?


On Sep 6, 2009, at 15:23 PM, Robert Poland wrote:


On Sep 6, 2009, at 4:07 PM, email@hidden wrote:

 This version should work for 24 hour clocks.

ES

set wakeTime to "21:01"
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":", " "}
set {wakeHour, wakeMin} to text items of wakeTime
set AppleScript's text item delimiters to oldDelims
set h to wakeHour as integer
if h < 13 then
set amOrPm to " am"
else
set amOrPm to " pm" 
set afterNoonTime to "1:00 pm"
if time string of date afterNoonTime contains "13" then set h to h - 12
end if
set m to wakeMin as integer
if m < 10 then set m to "0" & m
set wakeTime to (h & ":" & m & amOrPm)
set WakeUpTime to short date string of (current date)
set WakeUpTime to date (WakeUpTime & space & wakeTime)
(time string of WakeUpTime)

Strange, with 24h clock and adding; 
display dialog WakeUpTime as string
I get "Monday, September 7, 2009 9:01:00 AM "
Same for 12h clock.


Bob Poland - Fort Collins, CO





Bob Poland - Fort Collins, CO





Bob Poland - Fort Collins, CO



 _______________________________________________
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

  • Follow-Ups:
    • Re: new (I think) time question
      • From: 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>)
 >Re: new (I think) time question (From: Robert Poland <email@hidden>)
 >Re: new (I think) time question (From: "email@hidden" <email@hidden>)
 >Re: new (I think) time question (From: Robert Poland <email@hidden>)
 >Re: new (I think) time question (From: "email@hidden" <email@hidden>)
 >Re: new (I think) time question (From: Robert Poland <email@hidden>)
 >Re: new (I think) time question (From: "email@hidden" <email@hidden>)
 >Re: new (I think) time question (From: Robert Poland <email@hidden>)
 >Re: new (I think) time question (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: date/Snow Leopard changed
  • Next by Date: Re: Paste Text Into Mail
  • Previous by thread: Re: new (I think) time question
  • Next by thread: Re: new (I think) time question
  • Index(es):
    • Date
    • Thread