There is a different behavior between CF and Lucee on how a timestamp is casted to string in a cfquery:
<cfset qry= queryNew("name,birthday", "varchar,timestamp", [
{ "name": "Susi", "birthday": CreateDateTime(1950, 4, 29, 10, 23, 0) },
{ "name": "Jack" , "birthday": CreateDateTime(1982, 9, 6, 3, 0, 0) }
])>
<!--- <cfdump var="#qry#" /> --->
<cfquery name="q0" dbtype="query">
select birthday from qry
</cfquery>
<cfset curDt = now()>
<cfoutput>
q0.birthday=#q0.birthday#, correct q0.birthday string=#LSDateTimeFormat(q0.birthday, 'yyyy-mm-dd HH:nn:ss')#, curDt=#curDt#<br>
</cfoutput>
<cfset d = CreateDateTime(1950, 4, 29, 10, 23, 0) >
<cfoutput>
<br>
a simple date =#d#
<br>
</cfoutput>
With CF the output is:
q0.birthday=1950-04-29 10:23:00.0, correct q0.birthday string=1950-04-29 10:23:00, curDt={ts ‘2024-05-03 19:41:03’}
a simple date ={ts ‘1950-04-29 10:23:00’}
With Lucee the output is:
q0.birthday={ts ‘1950-04-29 10:23:00’}, correct q0.birthday string=1950-04-29 10:23:00, curDt={ts ‘2024-05-03 19:42:05’}
a simple date ={ts ‘1950-04-29 10:23:00’}
please note the difference of formats
q0.birthday=1950-04-29 10:23:00.0
q0.birthday={ts ‘1950-04-29 10:23:00’}
Lucee versions:
- 6.0.1.83 with openjdk11_jre_x32_windows_hotspot_jdk-11.0.23+9
- 6.1.0-SNAPSHOT+132 with jdk-21.0.3+9
CF versions:
- adobe@11.0.19+314546 with openjdk8_jre_x32_windows_hotspot_jdk8u412-b08
- adobe@2023.0.7.330663 with openjdk11_jre_x32_windows_hotspot_jdk-11.0.23+9
OS: Windows 11