Incorrect result from toString on the TimeImpl returned from CreateODBCTime

I stumbled upon this issue when transitioning from adobe to lucee:

The CreateODBCTime returns a lucee.runtime.type.dt.TimeImpl object that when calling toString(), it returns a formatted date and time instead of a odbc time format.

CreateODBCTime(now()).toString();
this returns “Thu May 12 16:44:46 GMT 2022”
I expected to get “{t ‘12:44:46’}”

I am able to work around the issue using:
CreateODBCTime(now()) & “”;

this returns “{t ‘12:44:46’}” as expected.

Don’t forget to tell us about your stack!

using: ortussolutions/commandbox:alpine-3.4.5
OS: Linux (5.4.72-microsoft-standard-WSL2) 64bit
Java Version: 11.0.14.1 (Eclipse Adoptium) 64bit
Tomcat Version: ???
Lucee Version: Lucee 5.3.9.133

Ticket in Jira: [LDEV-2767] - Lucee

@rich_hansen_gs If we use a toString(CreateODBCTime(now())) we can get the expected result.

@rich_hansen_gs could you raise a ticket for that at issues.lucee.org? We simply have to overwrite the toString method of that class. BTW your workaround and @cfmitrah is faster than your initial code, because the the intial code uses reflection to call a native method.

2 Likes

@micstriit @rich_hansen_gs Bug filed [LDEV-3993] - Lucee