• 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: Current date in standard additions dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Current date in standard additions dictionary


  • Subject: Re: Current date in standard additions dictionary
  • From: email@hidden
  • Date: Sun, 3 Jun 2001 15:20:30 EDT

I was wanting a time_slug to be in 12 hour format. The applescript guide
gives the following subroutine for a time_slug in the format I want, but it
is in military time. Does anybody know how to convert to 12 hour format?
Thanks. John

set the time_slug to my format_time_using(the current date,":",{"H","MM"})

on format_time_using(this_date_record, delimiter_string, format_list)
set the time_index to the time of this_date_record
set the hour_index to ((the time_index) / hours) div 1
set the minute_index to ,
(((the time_index) / minutes) - (the hour_index * 60)) div 1
set the seconds_index to ,
((the time_index) - (the hour_index * 3600) - (the minute_index *
60)) div 1
set the formatted_time to ""
-- count the number of items in the list
set the item_count to the count of the format_list
-- parse the format list
repeat with i from 1 to the item_count
set this_item to item i of the format_list
if this_item is "H" then
set the formatted_time to ,
the formatted_time & the hour_index as string
else if this_item is "HH" then
if the hour_index is less than 10 then ,
set hour_index to ,
("0" & (the hour_index as string))
set the formatted_time to ,
the formatted_time & hour_index as string
else if this_item is "M" then
set the formatted_time to ,
the formatted_time & the minute_index as string
else if this_item is "MM" then
if the minute_index is less than 10 then ,
set minute_index to ,
("0" & (the minute_index as string))
set the formatted_time to ,
the formatted_time & minute_index as string
else if this_item is "S" then
set the formatted_time to ,
the formated_time & the seconds_index as string
else if this_item is "SS" then
if the seconds_index is less than 10 then ,
set seconds_index to ,
("0" & (the seconds_index as string))
set the formatted_time to ,
the formatted_time & seconds_index as string
end if
if i is not the item_count then
-- add delimiter
set the formatted_time to ,
the formatted_time & delimiter_string as string
end if
end repeat
return the formatted_time
end format_time_using


  • Prev by Date: Re: Current date in standard additions dictionary
  • Next by Date: Re: Avoiding Scientific Notation?
  • Previous by thread: Re: Current date in standard additions dictionary
  • Next by thread: Re: Current date in standard additions dictionary
  • Index(es):
    • Date
    • Thread