I've had to deal with international time issues myslef, so here's a code I
developed that should parse the time correctly from whatever settings
(hopefully) the user's machine might have. The "systime" returned is a 24
hour clock: hh:mm

Hope this helps you!


on parseTime me
  systime=the short time
  --  systime="11:20 PM" -- You can test different time settings here

  --just in case the time seperator is not ":",
  --this checks for any kind of non-number as seperator,
  --and sets the item delimiter to that number:

  repeat with i=1 to 3
    chr=systime.char[i]
    if "0123456789" contains chr then
      next repeat
    else
      the itemDelimiter=chr
    end if
  end repeat

  hour=integer(systime.item[1])
  tt=the last word of systime
  --check if the time has a PM, pm, Pm or whatever and is less then 13
  -- and also convert 12pm into 00:

  if (tt contains "P") or (tt contains "p") then
    if  hour<13 then
      hour=hour+12
        if hour=24 then
           hour=0
      end if
    end if
  end if

  hour=string(hour)

  if hour.chars.count < 2 then
    hour="0"&hour
  end if

  minute=systime.item[2].word[1]
  systime=hour&":"&minute
  --  put "systime="&systime
  the itemDelimiter=","
  return systime

end parseTime



Karina Steffens,
Multimedia Designer/Programmer

Martello Media Ltd.
4 Islington Avenue
Sandycove
Co. Dublin

Tel: +353 1 2844668
Fax: +353 1 2803195
http://www.martellomm.ie




[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to