datetimecoldfusioncfmlcoldfusion-11coldfusion-2018

parseDateTime output difference


My Coldfusion Development Server:

Server Product  ColdFusion
Version     11,0,13,303668 
Tomcat Version  7.0.75.0
Edition     Developer  
Operating System    Windows 10  

Coldfusion Production Server:

Server Product  ColdFusion 2018
Version 2018.0.04.314546
Tomcat Version  9.0.10.0
Edition Standard  
Operating System    Windows Server 2016 
<cfscript>
    t = parseDateTime("2019-11-10 23:20:51.000","yyyy-MM-dd HH:mm:ss");
    writeDump(t);
</cfscript>

Running the same code above the output are not the same.

Development Server Output:

{ts '2019-11-10 23:20:51'} - Good

Production Server Output:

{ts '2020-08-10 23:00:51'} - Bad

What settings do I need to adjust to make both output similar? What am I missing?


Solution

  • @Vlad Yes. I go through your issues in my local. I can able to reproduce that issue. But the thing is the pop-conversion argument mm is deprecated. Use nn for minutes.

    ColdFusion (2016 release) Update 3:

    -- You can use the masks t and tt to create a date/time object. For single-character time marker string, use t. For multiple-character time marker string, use tt.
    -- mm is deprecated. Use nn for minutes.
    

    So your code should be like,

    <cfscript>
            t = parseDateTime("2019-11-10 23:20:51.000","yyyy-MM-dd HH:nn:ss");
            writeDump(t);
    </cfscript>
    

    Output : {ts '2019-11-10 23:20:51'}

    Now your output same as older version of CF. Please check it and confirm that.

    For your more reference please visit https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-l/lsparsedatetime.html