> I have had more than this much trouble with ASP doing the same.
I did too until I changed all date manip to yyyy/mm/dd. the db was happy to accept it
(as all decient db's should) and all the vbscript functions worked as expected (eg
CDate() started working fine)
(digression: the problam with dates in ASP stems from the underlying OS date format.
both IIS and the Jet db engine - MSAccess - store dates as mm/dd/yyyy based on the
system clock and ignoring the LS settings. The problem was at what point the LS
settings "kicked in". "CDate()" is at a much lower level to "month()" and that's why
some functions worked while others got it wrong. But by religiously changing to
yyyy/mm/dd these problems went away. I was able to use JS to format the date to ISO
format within the <FORM /> and carry it into the DB correct every time. That's what
I'm trying to here with CF to bypass all this US Vs UK date formatting grief)
Salvatore, to be honest I was a bit harsh on CF with dates. I've now got it working
correctly and the grief with functions like LSDateFormat() and ISO date formats is
simply the delims. yyyy/mm/dd causes an error. yyyy-mm-dd works just fine.
eg:
<cfset args.data.DOB = LSDateFormat("1976-11-04","yyyy-mm-dd") />
gets saved fine in the db with
dob = <cfqueryparam cfsqltype="CF_SQL_DATE" value="#arguments.data.dob#">
and if I could trust the date comming in, I could ditch the LSDateformat() function.
now the suggestions by Kola and others to convert to a "date object" is (IMHO) stil
valid. Ultimatly though, CF is an untyped language and the underlying/intrinsic
datatype for date is simply a string in a particular format( {ts '1976-11-04
00:00:00'} - see Stephen Moretti's post and link). Mind you, I've had a wierd problem
where CF wanted to convert a non-date string with "{ts '" into a date....
Ellis is also right, since this is what createODBCDate() does and why our prev
work-around of constructing the date strings manually worked.
I'll be looking further into this but the answer seems to be use the ISO date format
and all should be sweet.
cheers
barry.b
----- Original Message -----
From: Ellis Wood <[EMAIL PROTECTED]>
Date: Wed, 7 Jul 2004 16:09:25 +0100
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] LS date woes - any ideas?
> I have had more than this much trouble with ASP doing the same. It's a
> middleware to DB problem not language specific. Have you tried the
> createODBCDate() function?
>
> -----Original Message-----
> From: Salvatore Fusto [mailto:[EMAIL PROTECTED]
> Sent: 07 July 2004 14:40
> To: [EMAIL PROTECTED]
> Subject: Re: [ cf-dev ] LS date woes - any ideas?
>
> hello, i fill the date form fill as dd/mm/yyyy, i.e. 01/03/1996, then pass
> this field to database. when i retreive the value from database, i set the
> fiels LSdateFormat(#date_var#,'dd/mm/yyyy') which displays 01/03/1996,
> supposing date_val contains the date
> best regards
> salvatore
> ----- Original Message -----
> From: "Barry L Beattie" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 07, 2004 1:12 PM
> Subject: [ cf-dev ] LS date woes - any ideas?
>
>
> > Hi all
> >
> > I've been bitten with CF's rejection of the ISO date format with
> LSDateFormat and general grief with non-US dates (esp with dd/mm/yyyy). The
> idea is simply to pass a date from a form to a cfqueryparam in ISO format
> without grief. I'm not winning.
> >
> > "invalid date format" LSDateFormat("1996/01/03","yyyy/mm/dd")
> >
> > Apart from tearing the date apart and re-assembling it or using "mmm" for
> months, is there anything else that consistantly works?
> >
> > I never had this much grief with ASP (when I used the ISO format).
> >
> > cheers
> > barry.b
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > _______________________________________________
> > Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free!
> > http://www.net2phone.com/cgi-bin/link.cgi?143
> >
> >
> >
> >
> >
> > --
> > These lists are syncronised with the CFDeveloper forum at
> http://forum.cfdeveloper.co.uk/
> > Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> >
> > CFDeveloper Sponsors and contributors:-
> > *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
> by activepdf.com*
> > *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
> proworkflow.com*
> > *Tutorials provided by helmguru.com* :: *Lists hosted by
> gradwell.com*
> >
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> These lists are syncronised with the CFDeveloper forum at
> http://forum.cfdeveloper.co.uk/
> Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> CFDeveloper Sponsors and contributors:-
> *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
> by activepdf.com*
> *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
> proworkflow.com*
> *Tutorials provided by helmguru.com* :: *Lists hosted by
> gradwell.com*
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
>
>
> --
> These lists are syncronised with the CFDeveloper forum at
> http://forum.cfdeveloper.co.uk/
> Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> CFDeveloper Sponsors and contributors:-
> *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by
> activepdf.com*
> *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
> *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
>
--
_______________________________________________
Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free!
http://www.net2phone.com/cgi-bin/link.cgi?143
--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by
activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]