No matching function [STR2DATE] found; not sure why this function isn't working

We are converting from ACF to Lucee 4.5. We are now testing our websites
for bugs.

We have a problem with a function not being found when called.

Here is the code for the function: (it is up a couple directories from the
file in which it is being called in a file named app_globals.cfm)

function Str2Date(stringdate) {
if (stringdate EQ “”) { return “Error: blank date”; }

// must be a 14 character string of numbers
if (REFind("^[0-9]{14}$",stringdate) EQ 0) { return “Error: bad date
(#stringd
ate#)”; }

year = Left(stringdate,4);
month = Mid(stringdate,5,2);
day = Mid(stringdate,7,2);
hour = Mid(stringdate,9,2);
min = Mid(stringdate,11,2);
sec = Right(stringdate,2);

return("{ts ‘#year#-#month#-#day# #hour#:#min#:#sec#’}");

}

And the calling code:

#DateFormat(Str2Date(sui_submitted),"mm/dd/yy")#

Can anyone tell me, by looking at the code above, what the issue is?

Thanks!

It really depends on how you are including the app_globals.cfm. If you’re using Application.cfc and including them within one of the functions, those UDF’s won’t be globally available.

I’d need to know more about how you’re including the globals file before I could venture a reason for the missing method exception.

That said, based on your usage, that UDF is unnecessary. parseDateTime is already a function and you can set the mask for it to the specifics of what that function is looking for.

If you need that function to create SQL timestamps, will handle that for you, along with the createODBCDateTime function.On April 28, 2016 at 11:42:03 AM, Josh Beach (@Josh_Beach) wrote:

We are converting from ACF to Lucee 4.5. We are now testing our websites for bugs.

We have a problem with a function not being found when called.

Here is the code for the function: (it is up a couple directories from the file in which it is being called in a file named app_globals.cfm)

function Str2Date(stringdate) {
if (stringdate EQ “”) { return “Error: blank date”; }

// must be a 14 character string of numbers
if (REFind("^[0-9]{14}$",stringdate) EQ 0) { return “Error: bad date (#stringd
ate#)”; }

year = Left(stringdate,4);
month = Mid(stringdate,5,2);
day = Mid(stringdate,7,2);
hour = Mid(stringdate,9,2);
min = Mid(stringdate,11,2);
sec = Right(stringdate,2);

return("{ts ‘#year#-#month#-#day# #hour#:#min#:#sec#’}");

}

And the calling code:

#DateFormat(Str2Date(sui_submitted),"mm/dd/yy")#

Can anyone tell me, by looking at the code above, what the issue is?

Thanks!


Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/c349c308-d1fc-441e-a49b-ce5bde31ef52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.