Dave DuPlantis wrote:
> It seems as though the OP is struggling with the
difference between validation for CF's
> purposes and validation for the destination's purposes.
Yes. That is the nature of using date strings versus
date/time objects. The interpretation and conversion is handled by
the parent application. So the conversion rules are very likely to
differ from one application to another and the results may vary.
That is why is usually not the best way to transfer date values
from CF to a database.
As mentioned in earlier responses, the safer method is to use
date/time objects, not strings. Then there is no ambiguity and you
do not have to concern yourself with whether the database will
interpret a date string differently than ColdFusion. For even
greater control over how the values are constructed, the createDate
and createDateTime functions are useful.
> The date/time object can also be passed to DateFormat as
a string ...
Yes, but it
expects
/ operates on a date/time object. That and the fact that it
returns a string, not a date, are subtle but key distinctions.
> The ability to pass a string when a date/time object is
desired is nice in terms
> of flexibility, but it also complicates any attempt to
explain the situation!
Very true. I think it can also lead to confusion about the
usage of some date functions. Take for example DateFormat. The fact
that you can also pass in a string, letting CF handle the
conversion, seems to give some people the wrong impression about
what the function actually does. I read several recent posts where
the individual mistakenly thought the DateFormat function converts
a string to date/time object, and that the mask tells CF how to
interpret the supplied string. It does not. So while this thread
was not really about DateFormat .. a small clarification was
warranted. Just in case future readers are similarly confused ;-)