is a date
Yves COPPE
yvescoppe at mac.com
Sat Oct 14 15:14:55 EDT 2017
Hi,
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
answer CheckDate(tDate)
> Le 14 oct. 2017 à 19:27, Roger Eller via use-livecode <use-livecode at lists.runrev.com> a écrit :
>
> That's what I suspected. So to build a slightly better trap, I am doing
> this:
>
> if tDate is a date and length(tDate) > 5 and tDate contains "/" then
> put "true"
> else
> put "false"
> end if
>
> I am sure there is probably a standard way to catch all possible date
> formats (excluding "the seconds"), but this works for most.
>
> ~Roger
>
>
> On Sat, Oct 14, 2017 at 12:44 PM, Klaus major-k via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
>> Hi Roger,
>>
>>> Am 14.10.2017 um 18:30 schrieb Roger Eller via use-livecode <
>> use-livecode at lists.runrev.com>:
>>>
>>> put "11/20/2017" is a date
>>> returns true
>>> ----
>>> put "10" is a date
>>> returns true
>>> ----
>>> put "raccoon" is a date
>>> returns false
>>> ----
>>>
>>> WHY is "10" seen as a date?
>>
>> looks like the engine is seeing seconds also as a possible valid date.
>>
>> convert 0 to long date and long time;put it -> Thursday, January 1, 1970
>> 1:00:00 AM
>> 1:00:00 = DST here in germany!
>>
>> convert 10 to long date and long time;put it -> Thursday, January 1, 1970
>> 1:00:10 AM
>> etc...
>>
>> And of course:
>> put (the seconds) is a date -> TRUE
>>
>>> ~Roger
>>
>> Best
>>
>> Klaus
>>
>> --
>> Klaus Major
>> http://www.major-k.de
>> klaus at major-k.de
>>
>>
>> _______________________________________________
>> 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
>>
> _______________________________________________
> 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