>- see footer for list info -<
> START - {ts '2005-01-07 00:00:00'}
> END - {ts '2005-01-07 00:00:00'}
be aware that dataFormat/LSDateformat are NOT intergchangable and behave very
differently (and because CF is a US product...)
Problem:
string representation of a data/time object straight from an Informix database:
{ts '2005-01-07 00:00:00'}
- DateFormat works fine
- LS dateFormat throws an error ("not a valid date format")
reason:
the correct date format is {ts '2005-01-07 00:00:000'} with the milliseconds
using 3 digits. LSDateFormat uses this. DateFormat is more forgiving and
doesn't care.
the fix:
- not in CF7, so give up looking
- do NOT trust any date formatting functions to guess correctly between
"dd/mm/yyyy" and "mm/dd/yyyy"
- do as others suggest and break the string apart (getToken, list functions,
etc) and convert to "yyyy-mm-dd" as soon as you get the date from the user (eg:
a form submitted). If you can convert the date to "yyyy-mm-dd" on the form
itself (eg with javascript) even better. This is still a string, tho, not a
date/Time object
- use cfqueryparam when using the data with the database
- Leave (and pass as arguments) as a string as much as possible
- if comparing dates (esp with now()) use createODBCdate(). Don't bother with
createODBCdate()use in SQL, keep it as a "yyyy-mm-dd" string and rely on the
inbuilt date formatting within cfqueryparam instead to keep the format square.
In theory, there should be NO use of dateFormat, it all should be LSDateFormat
and rely on the locale settings of the CF server - but, as outlined above, this
doesn't always work.
Is it the databases' datatypes not converting correctly? is it the JDBC drivers
themselves? is LSDateFormat broken or should be just forgiving as dataFormat?
who knows? All I know is it just gives me the s#!^s and I NEVER had this much
grief with dates in ASP!
my 2c
barry.b
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<