>- see footer for list info -<
If you can use dates in the "yyyy-mm-dd" format it stops any such problems
happening. If you get dates from forms in the "dd/mm/yyyy" format, you could
write a small script to make sure all your dates came back correctly
formatted (for the UK). Something like ... 

<CFSCRIPT>
        function ReturnDateUK(TheDate)  {
                if(ListLen(TheDate, "/") EQ 3)  {
                        if(Len(ListGetAt(TheDate, 3, "/")) EQ 4)        {
                                FixedDate=ListGetAt(TheDate, 3,
"/")&"-"&ListGetAt(TheDate, 2, "/")&"-"&ListGetAt(TheDate, 1, "/");
                                if(IsDate(FixedDate))   {
                                        return
CreateODBCDateTime(FixedDate);
                                }
                                else    {return "Not a valid date.";}
                        }
                        else    {return "Not a valid date.";}
                }
                else    {return "Not a valid date.";}
        }
</CFSCRIPT>

... should work OK. Then just pass all your dates to the 1 function. eg
FormEndDate = "02/11/2005" (received from a form posting), so to make sure
it is right, just ...

<CFSET FormEndDate=ReturnDateUK(FormEndDate)>

... will give you the date in UK date format only, or tell you it's not a
valid date.

-----Original Message-----
From: Paul Swingewood [mailto:[EMAIL PROTECTED] 
Sent: 20 October 2005 10:00
To: [email protected]
Subject: RE: [CF-Dev] more date problems

>- see footer for list info -<
Sorry all just spotted it..

I hate dates in coldfusion. Please Mr Coldfusion creator can you make the 
functions relative to UK dates when you set a locale. I'd expect this to 
work correctly rather than changing the ODBC date to US format .... 
AGHHHHHH!

Now I have to get all the date parts again and createdate to make sure it's 
the right way round. This should be so much simpler if you have set your 
date locale as UK ....

VERY ANNOYING ...!

Regards - Paul


>From: "Paul Swingewood" <[EMAIL PROTECTED]>
>Reply-To: Coldfusion Development <[email protected]>
>To: [email protected]
>Subject: [CF-Dev] more date problems
>Date: Thu, 20 Oct 2005 09:52:16 +0100
>
>>- see footer for list info -<
>This one just doesn't make sense .....
>
>I have a start and an end date .... I compare the two to see if the end is 
>before the start.
>It just doesn't work .....
>
><!--- This is what comes from the form --->
><cfset FormStartDate = "31/10/2005">
><cfset FormEndDate = "02/11/2005">
><!--- Now convert this to actual ODBC dates --->
><cfset NEwstartdate = CreateODBCDateTime(FormStartDate)>
><cfset Newenddate = CreateODBCDateTime(FormEndDate)>
><!--- If the End is befoe the start then its an error --->
><cfif DateCompare(NewEndDate, NewStartDate) EQ -1>
><cfoutput>
>Error <br>
>Start = #NewStartDate#<br>
>End = #NewEndDate#
></cfoutput>
></cfif>
><cfabort>
>
>This is crazy the 2 dates are displayed correctly and are in ODBC format.
>
>Anyone tell me whats going on here please ...?
>
>Regards - Paul
>
>
>_______________________________________________
>
>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 -<


_______________________________________________

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 -<


****************************************************************************
Notice: This e-mail and any attachments are confidential and may contain
legally privileged information and/or copyright material of Hansen
Technologies Limited or third parties.  Copying, distributing, disclosing,
commercialising or otherwise acting in reliance on this e-mail and any
attachments is strictly prohibited unless you are the addressee of this
e-mail and have written permission to do so.  If you have received this
e-mail in error please delete this e-mail (including any copies and
attachments) and contact Hansen Technologies Limited by return e-mail or by
telephone on + 61 39840 3000.  Any views expressed in this e-mail are those
of the individual sender and may not necessarily reflect the views of or be
a commitment by the organisation, except where the individual sender has the
authority and expressly states them to be so.
****************************************************************************
_______________________________________________

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 -<

Reply via email to