Skip to main content
Inspiring
May 1, 2014
Question

ColdFusion 9 and ColdFusion 10

  • May 1, 2014
  • 1 reply
  • 405 views

I have following JavaScrip code which works for ColdFusion 10, but not ColdFsuion 9.

Because I have ColdFusion production server so I need find a solution for ColdFusion 9.

I use SQL Server 2008 as backend.

If SQL server returns datetime type then I can get curr_date, curr_month and curr_year.

The datetime type return is 'April, 25 2014 00:00:00', but I want to dispaly without time section and if it is possible that I need display like mm-dd-yyyy or yyyy-mm-dd have more compact display.

If SQL server returns date type then rowdata, curr_date, curr_month, and curr_year are NaN.

SQL returns '2014-04-25' when I use Date Type which is what I need, but ColdFusion does not recognize when I pass to the other form and it reads NaN.

I understand that it is JavaScrip code, but for some reason they have different behavior on ColdFusion 9 and ColdFusion 10.

I would like to know is it possible to get compact date format and ColdFusion can recognize as a date field to parse right information,

Your help and information is great appreciated,

Regards,

Iccsi,

var d = new Date(rowdata[1]);

  

      var curr_date = d.getDate();

     var curr_month = d.getMonth() +1 ;

     var curr_year = d.getFullYear();

    This topic has been closed for replies.

    1 reply

    Legend
    May 1, 2014

    Need more data. How is the date from the cfquery (I'm assuming you are using cfquery to get the data from MS-SQL 2008 server) making it into the rowdata array?

    My guess is you are using whatever native format that the SQL server returns. I always format date and time variables with DateFormat and/or TimeFormat.

    iccsiAuthor
    Inspiring
    May 1, 2014

    Thanks a million for the information and help,

    I use cfstoredproc, I just return convert(char(10), myDate, 101) and it works, since 101 returns mm/dd/yyyy.

    Thanks again for helping,

    Regards,

    Iccsi,

    BKBK
    Community Expert
    Community Expert
    May 1, 2014

    I still don't understand. In fact, I have the same question as Steve. How do you pass date data from the query to Javascript?