0

How do you fix it?

ColdFusion

Since I haven't blogged in a while I thought I'd post this for you all.  How do you fix this error in CF??

Error:"2007-02-29" is an invalid date or time string.
The error occurred on line 230.

Of course you have to take into account that in some years there will be a Feb. 29th!

Good Day!
Ryan

tags:
ColdFusion
 
Ryan, ColdFusion knows that it is good or not based on the year. Go stick this into a CFSCRIPT and run it:

for (i=2000;i LTE 2020;i=i+1)   {
   WriteOutput(IsValid("date",i&"-02-29") & "
");
}
 
posted 662 days ago
Add Comment Reply to: this comment OR this thread
 
Rob Wilkerson said:
 
You don't. I think the key here, as Dave suggests, is that 2/29/2007 *is* an invalid d/t string. Nothing to be fixed. :-)
 
posted 662 days ago
Add Comment Reply to: this comment OR this thread
 
Ryan said:
 
So I guess I can use Dave's IsValid function before sending the date to the database. Does anyone know if there is a similar JS function that I can run onSubmit?
 
posted 662 days ago
Add Comment Reply to: this comment OR this thread
 
 
Ryan, give this one a shot. I haven't tested it, but in just a cursory pass, it does appear to account for leap year.

Shared it here:
http://codeshare.ulatu.com/mar4f28f
 
posted 662 days ago
Add Comment Reply to: this comment OR this thread
 
Scott Stroz said:
 
Or you could use isDate() or isLeapYear(), or a combination of both.
 
posted 661 days ago
Add Comment Reply to: this comment OR this thread
 

Search