This is a multi-part message in MIME format.

------=_NextPart_000_00E3_01C0F008.6D664F40
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Andy & Kevin ...
In my experience with profanities directed at CF in re to dates =
(especially when using an US server, and inputting UK style dates), =
there is a fairly easy way to ensure date integrity ::

<cfset iDate =3D dateformat([now() or say form.userdate],"d/mm/yyyy")>
<cfquery name=3D"insertmydatecorrectly" datasource=3D"mydata">
    INSERT INTO mytable
        (myfield)
    VALUES
        (
        '#dateformat(iDate,"d/mm/yyyy")#'
        )
</cfquery>

Since the month field is a double digit entry the DB isn't inclined to =
swap d for m when month is less than 12. This should make your life =
easier.

Regards,

Mark Terrill
Web Development Manager
Net Plus+ Internet Marketing
----------------------------------------------------------------------
Phone:  07 5577 8835  |  Fax: 07 5577 8836
Email: [EMAIL PROTECTED]
Website: http://www.netplus.net.au
----------------------------------------------------------------------

-----Original Message-----
From: Andy Ewings [mailto:[EMAIL PROTECTED]]=20
Sent: Thursday, June 07, 2001 12:25 AM
To: CF-Talk
Subject: RE: Interesting Date issue

Kevin

I have had an absolute nightmare with CF and dates.  I wrote a complex
application which completely depended on date manipulation and the only
robust way I found to do it was as follows.  I createed dates in CF by
using
CreateDate to perform date validation.  When I came to add it to the db
I
broke the date down by using the Year, Month, Day functions and passing
the
date in a string to SQL as dd/mm/yyyy.  I then entered the date into the
SQL
db ensuring that I had correctly set the dateformat in the db by using
SET
DATEFORMAT DMY.

This was the most robust way I could find.  I was annoyed at the fact
that
CF appeared to decide whether a date was dd/mm/yyyy or mm/dd/yyyy
depending
on the value of the day part (i.e. if it was over 12 or not)


------=_NextPart_000_00E3_01C0F008.6D664F40
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Andy &amp; Kevin ...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>In my experience with profanities =
directed at CF in=20
re to dates (especially when using an US server, and inputting UK style =
dates),=20
there is a fairly easy way to ensure date integrity ::</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;cfset iDate =3D dateformat([now() =
or say=20
form.userdate],"d/mm/yyyy")&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;cfquery =
name=3D"insertmydatecorrectly"=20
datasource=3D"mydata"&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; INSERT INTO =
mytable</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
(myfield)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; VALUES</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
(</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
'#dateformat(iDate,"d/mm/yyyy")#'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;/cfquery&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Since the month field is a double digit =
entry the=20
DB isn't inclined to swap d for m when month is less than 12. This =
should make=20
your life easier.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Mark Terrill<BR>Web Development =
Manager<BR>Net=20
Plus+ Internet=20
Marketing<BR>------------------------------------------------------------=
----------<BR>Phone:&nbsp;=20
07 5577 8835&nbsp; |&nbsp; Fax: 07 5577 8836<BR>Email: <A=20
href=3D"mailto:[EMAIL PROTECTED]";>[EMAIL PROTECTED]</A><BR>Website: =
<A=20
href=3D"http://www.netplus.net.au";>http://www.netplus.net.au</A><BR>-----=
-----------------------------------------------------------------</FONT><=
/DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-----Original Message-----<BR>From: =
Andy Ewings [<A=20
href=3D"mailto:[EMAIL PROTECTED]";>mailto:[EMAIL PROTECTED]<=
/A>]=20
<BR>Sent: Thursday, June 07, 2001 12:25 AM<BR>To: CF-Talk<BR>Subject: =
RE:=20
Interesting Date issue<BR><BR>Kevin<BR><BR>I have had an absolute =
nightmare with=20
CF and dates.&nbsp; I wrote a complex<BR>application which completely =
depended=20
on date manipulation and the only<BR>robust way I found to do it was as=20
follows.&nbsp; I createed dates in CF by<BR>using<BR>CreateDate to =
perform date=20
validation.&nbsp; When I came to add it to the db<BR>I<BR>broke the date =
down by=20
using the Year, Month, Day functions and passing<BR>the<BR>date in a =
string to=20
SQL as dd/mm/yyyy.&nbsp; I then entered the date into the<BR>SQL<BR>db =
ensuring=20
that I had correctly set the dateformat in the db by =
using<BR>SET<BR>DATEFORMAT=20
DMY.<BR><BR>This was the most robust way I could find.&nbsp; I was =
annoyed at=20
the fact<BR>that<BR>CF appeared to decide whether a date was dd/mm/yyyy =
or=20
mm/dd/yyyy<BR>depending<BR>on the value of the day part (i.e. if it was =
over 12=20
or not)<BR></DIV></FONT></BODY></HTML>

------=_NextPart_000_00E3_01C0F008.6D664F40--


Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to