is a date broke

Robert Presender rpresender at cox.net
Wed May 2 11:46:23 EDT 2007


On May 2, 2007, at 5:00 AM, Chipp Walters wrote:

> How come when you put in the msg box:
>
> put "01/01/01 are you kidding me" is a date
>
> you get true? Am I missing something?
> How do you validate a date entry?

Hi Chipp,

Using Mac 10.3.9, Rev 2.8.1- dp-2/3, Note: dp-1 only allows a 2 
numbered year: 07

Don't know if something like this is what you are looking for.
I use it in a closeField for a field that just contains a date: 
01/01/2007
If 13/42/2007 is entered, the answer dialog is shown. "is not a date 
works"

on cDateFormat pfldName
   set the itemDel to "/"
   put fld pfldName into hold
   if the num of chars of hold <>10 or hold is not a date or the num of 
chars of item 3 of hold is not 4 then
     answer information "Invalid date format. Please enter date in 
mm/dd/yyyy format." titled "Invalid format"
     select text of fld pfldName
     EXIT TO TOP
   end if
end cDateFormat

Regards ... Bob




More information about the use-livecode mailing list