[thelist] [ColdFusion] udf question

Raymond Camden ray at camdenfamily.com
Tue Nov 26 17:10:01 CST 2002


How exactly does IsDate fail on years? Your logic below (I'm ignoring
the syntax errors that others corrected) says that if the year is < 1900
or > 2500, it's invalid. This isn't true. It may be true for your
application - but it doesn't mean that the year 2600 is invalid. I guess
I'm being anal - but as far as I know, isDate works just fine.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Hire

Email    : ray at camdenfamily.com
WWW      : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org] On Behalf Of Kyle Murphy
> Sent: Tuesday, November 26, 2002 11:01 AM
> To: thelist at lists.evolt.org
> Subject: [thelist] [ColdFusion] udf question
>
>
> Because CF5's IsDate(string) function lacks actually checking if the
> year is valid, I'm attempting to write a udf to check if it's between
> 1900-2500.  Here's what I have so far:
>
> Line  1: function myIsDate(date)
> Line  2: {
> Line  3:  	var tempDate = date;
> Line  4:  	if (IsDate(tempDate)) {
> Line  5:  		var dateYear = DatePart(yyyy, tempDate);
> Line  6:  		if (dateYear gte 1900 AND dateYear lte 2500) {
> Line  7:  			return "YES";
> Line  8:  		}
> Line  9:  		else {
> Line 10:  			return "NO";
> Line 11:  		}
> Line 12:  	}
> Line 13:  	else
> Line 14:  		return "NO";
> Line 15:  }
>





More information about the thelist mailing list