A solution I developed for UK date handling. Hope it may be of use to someone.
Just paste this into a field script...

on openField
  set the uRevert of me to me
  if me<>"" then
    put me into temp
    convert temp to short date
    set the itemDel to "/"
    # Localise the short date format as required...
    put item 2 of temp&"/"&item 1 of temp&"/"&item 3 of temp into me
  end if
  select text of me
end openField

on closeField
  if me="" then
    set the uRevert of me to ""
  else
    put me into temp
    replace "." with "/" in temp
    replace "-" with "/" in temp
    set the itemDel to "/"
    # Localise the short date format as required...
    put item 2 of temp&"/"&item 1 of temp&"/"&item 3 of temp into temp
    convert temp to abbrev date
    if the result<>"" then
      put the uRevert of me into me
      # Adjust the message according to your centuryCutOff setting...
      answer "Invalid date"&cr&\
          "Dates should be between 1970 and 2034, and"&cr&\
          "be presented as these examples:"&cr&cr&\
          "   31-10-98   31.10.98   31/10/98" with "OK"
    else
      put temp into me
      set the uRevert of me to temp
    end if
  end if
end closeField

on exitField
  closeField
end exitField

/H

Hugh Senior

The Flexible Learning Company
Consultant Programming & Software Solutions
Fax/Voice: +44 (0)1483.27 87 27
Email: [EMAIL PROTECTED]
Web: www.flexibleLearning.com

Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to