is a date

Yves COPPE yvescoppe at mac.com
Sun Oct 15 06:10:54 EDT 2017


Hi,

I hope this works for any date format

on mouseUp

ask "Give a date"

if it is empty then exit to top

answer IsDate(it)

end mouseUp



function IsDate textToSearch

local theDay, TheMonth, TheYear

put empty into tresult

if matchtext(textToSearch,"(\d{1,2})/(\d{1,2})/(\d{2,4})",theDay,TheMonth,TheYear) is true then

put textToSearch into tresult

else

put "Invalid Date" into tresult

end if

return tresult

end IsDate


> Le 14 oct. 2017 à 21:52, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> a écrit :
> 
> On 10/14/17 2:14 PM, Yves COPPE via use-livecode wrote:
>> Try this
>> function CheckDate pDateToCheck
>> return matchText(pDateToCheck,"([1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9][0-9][0-9])")
>> end CheckDate
> 
> Promising, but fails with dates like "1/1/19".
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list