[thelist] [ColdFusion] udf question

Kyle Murphy kyle.murphy at tempschedulingsystem.com
Tue Nov 26 11:00:00 CST 2002


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:  }

I'm getting the following error:
---------------------------------------------------
Invalid parser construct found on line 868 at position 3. ColdFusion was
looking at the following text:

var
Invalid expression format. The usual cause is an error in the expression
structure.
---------------------------------------------------

This is my sad attempt at writing my first real udf, so please be nice
:)

Kyle





More information about the thelist mailing list