I second Brett's method.. I do the same thang myself. Regards, Adam
-----Original Message----- From: Brett Payne-Rhodes [mailto:bret...@gmail.com] Sent: Friday, February 20, 2009 3:17 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Validating dates ... what's the trick? I could never get a reliable result from the various 'parsedate' functions... In the end I wrote my own function to create dates from strings. It looks for a variety of delimiters then extracts day, month, year; or month, year, day; or even year, month, day; depending on how it was set up. The trick at the end is to use createDate(year, month, day) wrapped up in a try/catch. If it throws an error then you have a problem. hth Brett B) Mike Kear wrote: > I'm trying to catch when a user inputs an invalid date from a set of > dropdowns for day/month/year. What's the trick to using > IsValid("eurodate", .... ? This doesnt work if the user enters > 31/2/2009: > > <cfif not (IsValid("eurodate", > createdate(form.ShipYear,form.ShipMonth,form.ShipDay) )) > > Stuff.... > </cfif> > > > If i feed this line the 'date' 31/2/2009 it doesnt do the stuff > inside the cfif, it throws an error with the helpful error message > 'MONTH'. I guess its because inside the IsValid() function, it's > trying to create the date first, and never getting to run the > isvalid() function. > > But if the IsValid() function will only work when it's given a valid > date, what is the point of it? -- Brett Payne-Rhodes Eaglehawk Computing t: +61 (0)8 9371-0471 m: +61 (0)414 371 047 e: br...@ehc.net.au w: http://www.yoursite.net.au --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---