Yep, try/catch was how I was getting the error message I showed, it just
was out in the main logic and not in the subroutine.
Thanks for finding the issue, that's exactly what I meant by obvious!
--
Howard Fore, howard.f...@hofo.com
“What people say, what people do, and what they say they do are entirely
different things.” - Margaret Mead
On Wed, Jun 27, 2012 at 12:14 AM, Troy Jones t...@dynapp.com wrote:
Howard,
** **
One thing I might suggest is to try/catch the logic and dump the cfcatch
scope into an email. This will probably yield you a more robust error
report than what you see here.
** **
I took your function and modified it just a bit to see if I could find
something out. It looks like that, when you set the date as “31oct2012”,
the reason its yielding an error is because of your list being out of
chronological order. Oct and Nov are switched. I fixed them up; the
function returns the expected data.
** **
** **
*From:* ad...@acfug.org [mailto:ad...@acfug.org] *On Behalf Of *Howard
Fore
*Sent:* Tuesday, June 26, 2012 9:25 PM
*To:* ACFUG Discussion
*Subject:* [ACFUG Discuss] Re: Odd CreateDate error
** **
Actually that date string works ok. But 31Oct2011 does not. 30Oct2011
is ok, Halloween isn't. Grr.
--
Howard Fore, howard.f...@hofo.com
“What people say, what people do, and what they say they do are entirely
different things.” - Margaret Mead
On Tue, Jun 26, 2012 at 9:04 PM, Howard Fore howard.f...@hofo.com wrote:
I'm sure there's some blindingly obvious thing I'm doing wrong here, but I
can't see it. Any ideas would be extremely helpful.
** **
cffunction name=dateConverter
cfargument name=strDate required=yes
cfargument name=strFormat required = yes
cfset var rtnDate = createDate(1900,1,1)
** **
cfif arguments.strFormat is ddmmm
!--- example: 31jan2012 ---
cfset var dateParts =
RefindNoCase('([0-9]{1,2})([a-z]{3,3})([0-9]{4,4})',arguments.strDate,1,true)
cfif dateparts.pos[2] neq 0
cfset var theDate = {}
** **
cfset theDate.days =
mid(arguments.strDate,dateParts.pos[2],dateParts.len[2])
** **
cfset theDate.month =
mid(arguments.strDate,dateParts.pos[3],dateParts.len[3])
cfset var theMonthsList =
'jan,feb,mar,apr,may,jun,jul,aug,sep,nov,oct,dec'
cfset theDate.monthNumber = ListFind(theMonthsList,theDate.month)
** **
cfset theDate.year =
mid(arguments.strDate,dateParts.pos[4],dateParts.len[4])
** **
cfset rtnDate = createDate(theDate.year, theDate.monthNumber,
theDate.days)
/cfif
** **
/cfif
cfreturn rtnDate
/cffunction
** **
** **
cfset theDate = 12oct2012
cfoutput#dateConverter(theDate,'ddmmm')#/cfoutput
** **
gives me (in CF 9.0.1) an extremely unhelpful error (line 37 in the stack
trace below is the cfset rtnDate line towards the end of the above function:
** **
*struct*
Message
MONTH
StackTrace
java.lang.IllegalArgumentException: MONTH at
java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2482) at
java.util.Calendar.updateTime(Calendar.java:2469) at
java.util.Calendar.getTimeInMillis(Calendar.java:1088) at
java.util.Calendar.getTime(Calendar.java:1061) at
coldfusion.util.DateUtils.createDate(DateUtils.java:959) at
coldfusion.runtime.CFPage.CreateDate(CFPage.java:1009) at
cfindex2ecfm2067856441$funcDATECONVERTER.runFunction(D:\frba\pages\research\inflationproject\dashboard\index.cfm:37)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582) at
cfindex2ecfm2067856441._factor2(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1251)
at
cfindex2ecfm2067856441._factor11(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1242)
at
cfindex2ecfm2067856441._factor12(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1156)
at
cfindex2ecfm2067856441._factor13(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1154)
at
cfindex2ecfm2067856441._factor14(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1146)
at
cfindex2ecfm2067856441._factor24(D:\frba\pages\research\inflationproject\dashboard\index.cfm:1137)
at
cfindex2ecfm2067856441._factor32(D:\frba\pages\research\inflationproject\dashboard\index.cfm:13)
at
cfindex2ecfm2067856441.runPage(D:\frba\pages\research\inflationproject\dashboard\index.cfm:12)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at
coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at