The mega wierd part is that if i run the code:

<cffile action="read" file="#AbsolutePath#\AnimaisOnline\Chat\UltimaAtualizacao.txt" 
variable="dtUltimaAtualizacao">

<cfif IsDate("#dtUltimaAtualizacao#")>
 yes
<cfelse>
 no
</cfif>

#LsDateFormat(dtUltimaAtualizacao, 'dd/mm/yyyy')#

It returns TRUE (yes) for the cfif condition (it is a DateTime object) but the 
LSDateFormat does not work (error "{ts &apos;2003-01-07 16:23:09&apos;} " is an 
invalid date format. )

i realy need to add the line: 
<cfset dtUltimaAtualizacao = CreateODBCDateTime("#dtUltimaAtualizacao#")>

befor the #LsDate function... That's wierd and definitly not nice =/. Maybe i should 
post a bug @ MM page.


  ----- Original Message ----- 
  From: Leonardo Crespo - Cftop.COM 
  To: CF-Talk 
  Sent: Monday, February 24, 2003 3:31 PM
  Subject: Re: URGENT, cfmx interprets MYSQL date (yyyy-mm-dd hh:mm:ss) as INVALID!


  I got it working by this code:

  <cffile action="read" file="#AbsolutePath#\AnimaisOnline\Chat\UltimaAtualizacao.txt" 
variable="dtUltimaAtualizacao">

  <cfset dtUltimaAtualizacao = CreateODBCDateTime("#dtUltimaAtualizacao#")>

  #LsDateFormat(dtUltimaAtualizacao, 'dd/mm/yyyy')#


  Note the cfset tag. Looks like CFMX treats the first dtUltimaAtualizacao as a string 
instead of a DateTime object as CF5 does. 

  That's not nice =/. Does anyone have another solution or another tip for that or 
should i really have to put the cfset tag in all my templates that handle dates? 

  Thank you. 
  (ps, i also have posted this on mm foruns, if i got the solution i will let you guys 
know)
    ----- Original Message ----- 
    From: Mike Townend 
    To: CF-Talk 
    Sent: Monday, February 24, 2003 3:15 PM
    Subject: RE: URGENT, cfmx interprets MYSQL date (yyyy-mm-dd hh:mm:ss) as INVALID!


    Drop the quotes...

    #LsDateFormat(DateVar, 'dd/mm/yyyy')#

    Instead of

    #LsDateFormat("DateVar", 'dd/mm/yyyy')#

    HTH




    Mikey

    =========================================
    http://www.phonebin.com
    "From Phone to Web in minutes" 


    -----Original Message-----
    From: Leonardo Crespo - Cftop.COM [mailto:[EMAIL PROTECTED] 
    Sent: Monday, February 24, 2003 18:05
    To: CF-Talk
    Subject: URGENT, cfmx interprets MYSQL date (yyyy-mm-dd hh:mm:ss) as
    INVALID!


    I'm evaluating cfmx on j2ee. I use mysql as database and all my date are
    stored in mysql default format, witch is "yyyy-mm-dd hh:mm:ss". I'm using
    the Portugues(Brazilian) locale. 

    As you know, MYSQL stores DateTime objects in the format "YYYY-MM-DD
    HH:MM:SS". 

    When i try to run the code:

    <cfquery name=bla....>
    Select DateField from .... 
    </cfquery>

    <cfset DateVar = bla.DateField> (suppose DateVar has the value "2003-02-23
    18:34:59 ") #LsDateFormat("DateVar", 'dd/mm/yyyy')# 

    it throws an error saying 2003-02-23 18:34:59 is an INVALID date format. 

    the same error is returned if i use the CREATEODBCDateTime function, as
    follow #LsDateFormat("CREATEODBCDateTime(Now())", 'dd/mm/yyyy')# throwns
    this error:

    "{ts &apos;2003-01-07 16:23:09&apos;} " is an invalid date format. 


    ALSO, 

    <cfset temp = ParseDateTime("{ts '2003-23-02 18:34:59'}")>
    <cfoutput>#LsDateFormat(temp, 'dd/mm/yyyy')#</cfoutput>

    outputs this:
    {ts '2003-02-24 12:52:28'} 02/11/2004 

    when the correct date is
    24/02/2003 (dd/mm/yyyy format). 


    I cant understand why the mysql default date format is not valid anymore. I
    realy dont want to change all my date fields in my database, or change all
    my code that use dates (witch are quite alot). Does anyone knows why CFMX
    does that and does anyone knows a solution? 

    Tks alot 

    Leonardo

    
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to