I am attempting to validate strings as datetimes using the ColdFusion function LSParseDateTime(). Most of the expected date formats work well, except for the format YYYY-MM-DD (which is the default SQL Server date format, I believe).
LSParseDateTime("2012-01-05"); // throws an error
// fine, I will reformat the string
LSParseDateTime("2012/01/05"); // still throws an error
// I have also experimented with locales
LSParseDateTime("2012/01/05", "en"); // also throws an error
LSParseDateTime("2012/01/05", "en_US"); // also throws an error
The function LSParseDateTime() does not see this as a valid date, which is fine. However, I then attempted to replace the hypens with slashes (e.g. YYYY/MM/DD) and validate the string. This too is not a valid date according to this function. This seems odd to me since this is the valid ISO-8601 format (is it not).
Has anybody had a similar issue? And more importantly, has anybody found a solution that still uses LSParseDateTime()?