Re: Current hour and minute
Re: Current hour and minute
- Subject: Re: Current hour and minute
- From: Nigel Garvey <email@hidden>
- Date: Fri, 2 Feb 2001 01:24:51 +0000
Bill Briggs wrote on Thu, 1 Feb 2001 19:59:04 -0300:
>
At 12:06 AM +0100 02/02/01, Emmanuel wrote:
>
>At 20:39 +0100 1/02/01, Bill Briggs wrote:
>
>>>time to text and in the
>
>>>format (HH:MM am/pm)
>
>>
>
> >text -1 through -11 of ((current date) as text)
>
>
>
>------------------
>
> -- "001 0:05:24"
>
>------------------
>
>
>
>hmmm.
>
>
I get
>
--> " 7:53:23 PM"
>
>
but you're using a 24 hour clock, and in that system am/pm are irrelevant.
time string of (current date)
... is more efficient for that result *and* works with any Date & Time
setting.
>
Of course it depends on what format you have set in the Date & Time
>
Control Panel. If this is something that he wants to be portable,
>
then he'll have to take a different approach. If he's using it on his
>
own system, then he can use it directly or adapt it.
That's right. If Tod's own settings are for a 12-hour display with colon
separators, this gets what he wants:
tell time string of (current date) to get text 1 thru word 2 & " " &
word -1
Otherwise, he's looking at something like:
set t to time of (current date)
set hr to text -2 thru -1 of ("0" & t div hours)
set min to text -2 thru -1 of ("0" & t mod hours div minutes)
if hr < 12 then
set period to " am"
else
set period to " pm"
end if
hr & ":" & min & period
NG